[ 
https://issues.apache.org/jira/browse/PDFBOX-4709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17241887#comment-17241887
 ] 

Tres Finocchiaro commented on PDFBOX-4709:
------------------------------------------

{quote}Surprisingly, this also happens in PDFBox 1.8, which uses font 
operations (or so I thought) instead of vector graphics. (*update: no, it uses 
graphics.drawGlyphVector()*)
{quote}
 

Whoops, I missed that updated note and sent our openjdk provider down a path of 
studying 1.8.... I'm not sure if this information is helpful, but they've 
gotten back to us with some interesting findings, quoting:
{quote}[...] the reason why the drawGlyphVector uses fill(g.getOutline(x, y)) 
method in 
[PathGraphics.java#L650|https://github.com/openjdk/jdk/blob/461c5fc63708638c8f50aa89a298c2f45efd2a97/src/java.desktop/share/classes/sun/print/PathGraphics.java#L650]
 because PDFBox sets a transform to the GlyphVector in[ 
PDSimpleFont.java#L349|https://github.com/apache/pdfbox/blob/41ae21bd4c3f304373d3b05f63af5325df248019/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java#L349]and
 it prevents calling drawString() method in [PathGraphics.java#L957
|https://github.com/openjdk/jdk/blob/461c5fc63708638c8f50aa89a298c2f45efd2a97/src/java.desktop/share/classes/sun/print/PathGraphics.java#L957]

... 

The idea to make it work is to set the the glyph transform to the graphics 
instead of the GlyphVector itself. Here is an example which I added to my 
PDFBox 1.8.16 fork [pdfbox/commit

|https://github.com/AlexanderScherbatiy/pdfbox/commit/4877e6606d28a439bec52fdf028f439d340e2700]

I investigated it to understand what happens with a text printed by PDFBox 1.8. 
As a result, the PDFBox 2.0. needs to be fixed not only by using 
2d.drawGlyphVector() but also applying glyph vector transforms to graphics.
{quote}
 

[~tilman] is this information useful or helpful?  If not, we can take this 
advice downstream and try to modify the behavior there.

 

!4d6a9ed5-45ef-4742-a21f-0903a883e2e8.jpeg!

 

 

> PDFBox prints text poorly in comparison to Adobe, Chrome, other apps
> --------------------------------------------------------------------
>
>                 Key: PDFBOX-4709
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4709
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.14
>         Environment: Windows 10
> AdoptOpenJDK 11
> PDFBox 2.0.14
>            Reporter: Lite M Finocchiaro
>            Priority: Major
>              Labels: Zebra
>         Attachments: 4d6a9ed5-45ef-4742-a21f-0903a883e2e8.jpeg, 
> Adoberesult.jpg, Drug-print.pdf, Drug-print.pdf, IMG_20191219_130048_2.jpg, 
> PDFBoxVSgraphicsobj.jpg, PDFBoxresult.jpg, PrintedWithPDFBox.pdf, Screen Shot 
> 2019-12-22 at 2.20.54 PM.png, Screen Shot 2019-12-22 at 2.21.00 PM.png, 
> linux-thermal-test-graphics-frc-4pt.pdf, linux-thermal-test-graphics-frc.pdf, 
> linux-thermal-test-pdfbox-4pt.pdf
>
>
> When printing a PDF from PDFBox to a Zebra GK420d thermal label printer, the 
> text from the PDF is blurry and appears to have the top and bottom cut off 
> compared to printing the same file through Adobe Acrobat.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to