[
https://issues.apache.org/jira/browse/PDFBOX-4597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16889107#comment-16889107
]
Tilman Hausherr commented on PDFBOX-4597:
-----------------------------------------
I researched this a bit more. The javadoc of {{getX()}} and {{getY()}} are
correct. One could say that these are the coordinates in awt, i.e. where (0,0)
starts at the top left. These are not PDF coordinates, there the origin is at
the bottom left.
The javadoc of {{getXDirAdj()}} and {{getYDirAdj()}} are also correct but
mysterious. They ignore the page rotation but take the text rotation and adjust
the coordinates to awt, i.e. where (0,0) starts at the top left. The text
rotation is detected in {{getDir()}}. (to add to the mystery, results for non
quadrant rotations are undefined).
In the attached file, for the text in the middle, the getX / getY coordinates
are (100,256.79102) (100,247.453) (100,239.669) etc. which is what you'd see as
an awt developer.
But the getXDirAdj / getYDirAdj coordinates are (143.209,100) (152.547,100)
(160.331,100) etc. This is more useful for text extraction, i.e. to compare the
positions when imagining these to be horizontal.
The link is also interesting... in the DrawPrintTextLocations.java example I
ended up working with {{getTextMatrix()}} instead, which is what he mentioned
at the end.
> TextPosition.getX() vs getXDirAdj()
> -----------------------------------
>
> Key: PDFBOX-4597
> URL: https://issues.apache.org/jira/browse/PDFBOX-4597
> Project: PDFBox
> Issue Type: Improvement
> Components: Documentation, Text extraction
> Affects Versions: 2.0.15
> Reporter: Gili
> Priority: Major
> Attachments: rot90.pdf
>
>
> Please explain the difference between "page rotation adjusted coordinates"
> and "text direction adjusted coordinates" as referenced by the TextPosition
> class. You can add an explanation (ideally a visual one) to the class or
> method Javadoc.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]