in reply to Converting PDF file to text
I had good success with using Apache Tika for text extraction from PDFs (also, Apache::Tika::Async).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting PDF file to text
by cerian (Novice) on May 12, 2017 at 17:13 UTC | |
Exception in thread "main" java.lang.ClassFormatError: org.apache.tika.cli.TikaCLI (unrecognized class file version) at java.lang.VMClassLoader.defineClass(libgcj.so.10) at java.lang.ClassLoader.defineClass(libgcj.so.10) at java.security.SecureClassLoader.defineClass(libgcj.so.10) at java.net.URLClassLoader.findClass(libgcj.so.10) at java.lang.ClassLoader.loadClass(libgcj.so.10) at java.lang.ClassLoader.loadClass(libgcj.so.10) at gnu.java.lang.MainThread.run(libgcj.so.10)I've been attempting to work with the Apache::Tika, Apache::Tika::Asynch, and Apache::Tika::Server modules; but without success. The only documentation I have found for them so far is the brief synopsis section on CPAN. Sadly, those contain errors. Do you have any additional documentation or working code snippets? I have yet to make one of these critters work. Examples of what I've tried are below: Attempt 1: Apache::Tika The value in $text is: Can't connect to localhost:9998 (Connection refused) LWP::Protocol::http::Socket: connect: Connection refused at /Library/Perl/5.18/LWP/Protocol/http.pm line 46.Attempt 2: Apache::Tika::Asynch
That *is* the CPAN synopsis. It doesn't work. It will die on line 2 with Can't locate object method "new" via package "Apache::Tika::Server" Additionally, there is no new() method within the Apache::Tika::Async class. Attempt 3: Apache::Tika::Server
This gets me the following: Got HTTP error code 595 on the call to $tika->get_text. If I uncomment the call to $tika->launch, I get: Use of uninitialized value in join or string at /Library/Perl/5.18/Apache/Tika/Server.pm line 81. So far I can find no other information on these libraries on-line. If anyone out there has some documentation or working examples on how to use them, I would love to see it. | [reply] [d/l] [select] |
by Corion (Patriarch) on May 13, 2017 at 06:35 UTC | |
Most likely the version of Java on your web server does not work with the version of Java the Tika JAR file requires. I can't help you there. I'm sorry that the synopsis of Apache::Tika::Async is broken - it should look like the following, but it seems I never released that fix onto CPAN:
But all of this is in vain if the Tika executable won't start. Update: I've now published the Git repository of the module, which contains some fixes I should also release soonish. | [reply] [d/l] |