[
https://issues.apache.org/jira/browse/PDFBOX-3616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15722860#comment-15722860
]
Tilman Hausherr commented on PDFBOX-3616:
-----------------------------------------
I have not really understood your code... apparently you're trying to calculate
the base by starting from an (assumed) top.
Getting the correct bounds is tricky in PDFBox because the PDF files are not
always correct. Sometimes desc and ascent and capheight are missing. Or the
font bounding box is too big.
You code will also fail with some documents for a different reason: you did not
consider type 3 fonts. These do not always have a 1/1000 scale.
I'd really recommend you use the code from
DrawPrintTextLocations.calculateGlyphBounds() (only available in 2.0.*), these
are the cyan rectangles in my screenshot. This calculates the correct bounds
for every glyph. If you run this for every unique glyph in a font, you can then
calculate an actual bounding box for your font, or just for all glyphs of a
line.
> Characters shifted up
> ---------------------
>
> Key: PDFBOX-3616
> URL: https://issues.apache.org/jira/browse/PDFBOX-3616
> Project: PDFBox
> Issue Type: Bug
> Reporter: Roman
> Labels: how-to
> Attachments: 00051-2a7-00052-2a7.pdf_page0.pdf,
> PDFBOX-3616-marked-1.png, screenshot-1.png
>
>
> We have tried this on both 1.8.12 and 2.0.3 versions and got the same result
> - character positions are shifted up.
> We are assuming X and Y positions are relative to CropBox.
> See [^screenshot-1.png], yellow highlights are upper than the texts.
> PDF doc is attached.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]