Am 30.06.2017 um 15:43 schrieb Esteban R:
Tilman: thanks for your answer! 
(https://lists.apache.org/thread.html/a6f20d16b76acbfe4c292bc2d0e7111de9173c7cd63aae330df3886a@%3Cusers.pdfbox.apache.org%3E)
 .

For some reason your answer didn't arrive to my e-mail account although other 
e-mails from [email protected] arrive ok :s .

To get a perfect bounding box for the cyan rectangle, the only thing one
could do would be to evaluate the content stream in the charproc:

We will ignore the issue by now, but in case we decide to implement a solution in the 
future... maybe we can just create a "mock" document with the content stream, 
render it with PDFImageWriter.writeImage and then find the bounding box in the resulting 
image?

Yeah, but how find it? There is some code in PDFDebugger in the trunk (Type3Font.java) that does create a mock document. But it's just an image. One would have to look at black pixels. What if (just in theory) the font is white? What might be tried is to process only the path commands and see what happens. But there's also the problem of some fonts that use tiny images.

I'll do something re: the example, i.e. add a comment that charProc.getGlyphBBox() is sometimes unreliable, and certainly not as good as the individual glyph bounds on vector fonts. And add some code to compensate for a glyph bbox that is larger than the font bbox.

Tilman



Esteban




________________________________
De: Esteban R <[email protected]>
Enviado: jueves, 29 de junio de 2017 02:20 p.m.
Para: [email protected]
Asunto: Box issue with type3 font


Hello. I'm using DrawPrintTextLocations.java (from 
http://svn.apache.org/repos/asf/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java)

to find the boxes for a character in the following pdf (a simplified version of 
a real life pdf):

http://wikisend.com/download/727732/boxissue_type3_font.pdf

but none of the boxes matches the printed character (see near the bottom of the 
page).

This is the output that I get:

http://wikisend.com/download/129910/boxissue_type3_font-marked-1.png


I have noticed that some values in the font have negative values... so I don't 
know if the file (or font) is corrupted or there is an issue in pdfbox (or in 
DrawPrintTextLocations). How can I get a tightly enclosing box for the 
character?


Esteban



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to