You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Tilman Hausherr <TH...@t-online.de> on 2015/11/11 19:54:46 UTC

PrintTextLocations when cropBox

PrintTextLocations brings different locations when there is a (smaller) 
cropBox.  This can be seen with the digitalcorpora file 011939.pdf, 
where the cropbox has x and y = 9.

BT
/F3 1 Tf
10 0 0 10 280.0398 724.3551 Tm
0 0 0 0.7 k
(RESEARCH) Tj
ET

1.8:
String[271.0398,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]R
String[275.6798,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=3.7000122]E
String[279.37982,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]S
String[284.01984,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=3.7000122]E
String[287.71985,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]A
String[292.35986,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]R
String[296.99988,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]C
String[301.6399,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]H


2.0:
String[280.0398,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]R
String[284.6798,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=3.7000122]E
String[288.37982,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]S
String[293.01984,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=3.7000122]E
String[296.71985,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]A
String[301.35986,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]R
String[305.99988,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]C
String[310.6399,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 
width=4.6400146]H


but is this correct? One could argue that the coordinates shown in 2.0 
are "absolute" coordinates, while the ones from 1.8 are relative (to a 
rendering). If 2.0 is kept as it is now, a snall change must be done in 
DrawPrintTextLocations.

          g2d.translate(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY());

Tilman



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


Re: PrintTextLocations when cropBox

Posted by John Hewson <jo...@jahewson.com>.
> On 11 Nov 2015, at 14:02, Tilman Hausherr <TH...@t-online.de> wrote:
> 
> Am 11.11.2015 um 20:49 schrieb John Hewson:
>>> On 11 Nov 2015, at 10:54, Tilman Hausherr <TH...@t-online.de> wrote:
>>> 
>>> PrintTextLocations brings different locations when there is a (smaller) cropBox.  This can be seen with the digitalcorpora file 011939.pdf, where the cropbox has x and y = 9.
>>> 
>>> BT
>>> /F3 1 Tf
>>> 10 0 0 10 280.0398 724.3551 Tm
>>> 0 0 0 0.7 k
>>> (RESEARCH) Tj
>>> ET
>>> 
>>> 1.8:
>>> String[271.0398,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>>> String[275.6798,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>>> String[279.37982,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
>>> String[284.01984,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>>> String[287.71985,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
>>> String[292.35986,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>>> String[296.99988,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
>>> String[301.6399,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
>>> 
>>> 
>>> 2.0:
>>> String[280.0398,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>>> String[284.6798,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>>> String[288.37982,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
>>> String[293.01984,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>>> String[296.71985,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
>>> String[301.35986,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>>> String[305.99988,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
>>> String[310.6399,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
>>> 
>>> 
>>> but is this correct? One could argue that the coordinates shown in 2.0 are "absolute" coordinates, while the ones from 1.8 are relative (to a rendering). If 2.0 is kept as it is now, a snall change must be done in DrawPrintTextLocations.
>>> 
>>>         g2d.translate(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY());
>> Coordinates should be relative to the cropbox. IMHO 1.8 is correct and 2.0 is wrong. Presumably this needs fixing in PDFTextStripper.
> 
> Why not in PDFTextStreamEngine ?

Yes, we could do it there if it makes sense.

> Tilman
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
> For additional commands, e-mail: dev-help@pdfbox.apache.org <ma...@pdfbox.apache.org>

Re: PrintTextLocations when cropBox

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 11.11.2015 um 20:49 schrieb John Hewson:
>> On 11 Nov 2015, at 10:54, Tilman Hausherr <TH...@t-online.de> wrote:
>>
>> PrintTextLocations brings different locations when there is a (smaller) cropBox.  This can be seen with the digitalcorpora file 011939.pdf, where the cropbox has x and y = 9.
>>
>> BT
>> /F3 1 Tf
>> 10 0 0 10 280.0398 724.3551 Tm
>> 0 0 0 0.7 k
>> (RESEARCH) Tj
>> ET
>>
>> 1.8:
>> String[271.0398,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>> String[275.6798,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>> String[279.37982,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
>> String[284.01984,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>> String[287.71985,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
>> String[292.35986,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>> String[296.99988,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
>> String[301.6399,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
>>
>>
>> 2.0:
>> String[280.0398,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>> String[284.6798,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>> String[288.37982,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
>> String[293.01984,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
>> String[296.71985,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
>> String[301.35986,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
>> String[305.99988,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
>> String[310.6399,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
>>
>>
>> but is this correct? One could argue that the coordinates shown in 2.0 are "absolute" coordinates, while the ones from 1.8 are relative (to a rendering). If 2.0 is kept as it is now, a snall change must be done in DrawPrintTextLocations.
>>
>>          g2d.translate(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY());
> Coordinates should be relative to the cropbox. IMHO 1.8 is correct and 2.0 is wrong. Presumably this needs fixing in PDFTextStripper.

Why not in PDFTextStreamEngine ?

Tilman

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


Re: PrintTextLocations when cropBox

Posted by John Hewson <jo...@jahewson.com>.
> On 11 Nov 2015, at 10:54, Tilman Hausherr <TH...@t-online.de> wrote:
> 
> PrintTextLocations brings different locations when there is a (smaller) cropBox.  This can be seen with the digitalcorpora file 011939.pdf, where the cropbox has x and y = 9.
> 
> BT
> /F3 1 Tf
> 10 0 0 10 280.0398 724.3551 Tm
> 0 0 0 0.7 k
> (RESEARCH) Tj
> ET
> 
> 1.8:
> String[271.0398,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
> String[275.6798,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
> String[279.37982,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
> String[284.01984,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
> String[287.71985,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
> String[292.35986,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
> String[296.99988,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
> String[301.6399,40.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
> 
> 
> 2.0:
> String[280.0398,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
> String[284.6798,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
> String[288.37982,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]S
> String[293.01984,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=3.7000122]E
> String[296.71985,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]A
> String[301.35986,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]R
> String[305.99988,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]C
> String[310.6399,31.644897 fs=1.0 xscale=10.0 height=6.2 space=2.3200002 width=4.6400146]H
> 
> 
> but is this correct? One could argue that the coordinates shown in 2.0 are "absolute" coordinates, while the ones from 1.8 are relative (to a rendering). If 2.0 is kept as it is now, a snall change must be done in DrawPrintTextLocations.
> 
>         g2d.translate(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY());

Coordinates should be relative to the cropbox. IMHO 1.8 is correct and 2.0 is wrong. Presumably this needs fixing in PDFTextStripper.

— John

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


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