You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by John Lussmyer <Co...@CasaDelGato.com> on 2019/10/30 02:48:55 UTC

Exact PDF text - add it back as an annotation

I have a bunch of PDF files that have had an OCR package run against them.
The problem is that it adds the text to the normal Page content, and tries to position the recognized text at the location in the image it was found.
So the text is mixed with lots of positioning, etc..  information.
I'd like to extract all the text as a block of text, and just add it all as a single item.  Probably an annotation.
There are lots of tools to extract text from a PDF - but they are all web based, or use a GUI to do one file at a time.
I want to just run this against a directory full of PDF's and have it do all of them.

Anyone know of such a tool?  Have one written?


Re: Exact PDF text - add it back as an annotation

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 01.11.2019 um 15:53 schrieb John Lussmyer:
> On Tue Oct 29 21:59:57 PDT 2019 THausherr@t-online.de said:
>> IIRC tesseract can do this. Not as annotation, but as invisible font.
> As far as I can tell, it does it the same way that other programs do.
> It's added to the content stream, mixed with all the commands for positioning, font size, etc...  Words are often broken up.
> I'm looking for something that just embeds the plain text, with NO markup.


Then the best would be to use tesseract to do an ordinary text-only OCR, 
then use that text to create a text annotation. See the 
AddAnnotations.java example in the source code download.

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Exact PDF text - add it back as an annotation

Posted by John Lussmyer <Co...@CasaDelGato.com>.
On Tue Oct 29 21:59:57 PDT 2019 THausherr@t-online.de said:
>IIRC tesseract can do this. Not as annotation, but as invisible font.

As far as I can tell, it does it the same way that other programs do.
It's added to the content stream, mixed with all the commands for positioning, font size, etc...  Words are often broken up.
I'm looking for something that just embeds the plain text, with NO markup.


--

Bobcats and Cougars, oh my!  http://john.casadelgato.com/Pets

Re: Exact PDF text - add it back as an annotation

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 30.10.2019 um 03:48 schrieb John Lussmyer:
> I have a bunch of PDF files that have had an OCR package run against them.
> The problem is that it adds the text to the normal Page content, and tries to position the recognized text at the location in the image it was found.
> So the text is mixed with lots of positioning, etc..  information.
> I'd like to extract all the text as a block of text, and just add it all as a single item.  Probably an annotation.
> There are lots of tools to extract text from a PDF - but they are all web based, or use a GUI to do one file at a time.
> I want to just run this against a directory full of PDF's and have it do all of them.
>
> Anyone know of such a tool?  Have one written?


IIRC tesseract can do this. Not as annotation, but as invisible font.

Tilman


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org