You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Kevin <ke...@nflguess.com> on 2010/09/02 00:20:53 UTC

Help with PDFBox & TextExtraction

Hello all,

I am working on a script that takes a vendor generated PDF document and
converts it to a text file that I can use to update our database. I have
tried multiple scripts and have yet to find one that works on this
particular PDF document. One script I had in PERL and one in PHP and both
worked on other PDF's but not this one.

Hopefully PDFBox can do what the others couldn't. Anyway I am having trouble
using this library, I'm a newbie when it comes to installing libraries and
especially Java libraries for use with PHP.

When I am all finsihed I would like to be able to save the vendor generated
PDF into a directory and when the script runs, if it finds it it will
convert to text and then start the input into the SQL. First things first, I
need to setup this library just to see if it will convert this PDF because
so many others have failed.

Any help with the installation/setup would be appreciated.

Thanks

Re: Help with PDFBox & TextExtraction

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Thu, Sep 2, 2010 at 12:20 AM, Kevin <ke...@nflguess.com> wrote:
> Any help with the installation/setup would be appreciated.

The easiest way to get started is to grab the pdfbox-app-1.2.1.jar
from the download page [1] and run it like this:

    $ java --jar pdfbox-app-1.2.1.jar ExtractText document.pdf

This command will write a "document.txt" file that contains the
extracted text from the given "document.pdf" document. See [2] for
more details about the ExtractText operation.

See [3] for instructions on how to use the same functionality from a
Java application instead of from the command line.

[1] http://pdfbox.apache.org/download.html
[2] http://pdfbox.apache.org/commandlineutilities/ExtractText.html
[3] http://pdfbox.apache.org/userguide/text_extraction.html

BR,

Jukka Zitting