[ 
https://issues.apache.org/jira/browse/PDFBOX-660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Villu Ruusmann updated PDFBOX-660:
----------------------------------

    Attachment: PDFBox.patch
                FontBox.patch

I have prepared a set of patches that appear to solve the problem.

The CFF "FontMatrix" Top DICT entry contains custom scaling values. The CFF 
specification suggests 1 to 1'000 scaling, but most CFF font programs in this 
document use 4.8828(..) to 10'000 scaling.

I looked for the usages of method PDFont#getFontMatrix() in the codebase and 
found only one match in class org.apache.pdfbox.util.PDFStreamEngine, where it 
is used to calculate the size of TextPosition instances. So, I added another 
usage to class org.apache.pdfbox.pdfviewer.PageDrawer to apply scaling to the 
AffineTransformation object that is passed on to the method 
PDFont#drawString(String, Graphics, float, AffineTransform, float, float).

I couldn't find the exact description of the FontMatrix object neither from the 
CFF nor the Type1 Font specification. I made a wild guess that the X- and 
Y-axis should be scaled independently after the first and fourth FontMatrix 
element, respectively. Please verify it if you can.

> Failure to Convert this PDF to Image Correctly
> ----------------------------------------------
>
>                 Key: PDFBOX-660
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-660
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>         Environment: Windows 7, Eclipse IDE
>            Reporter: Gary Lam
>            Priority: Minor
>         Attachments: 1.jpg, enroll_California.pdf, FontBox.patch, 
> frontpage-fixed.png, PDFBox.patch
>
>
> PDFBox was unable to convert this PDF correctly into an image. I've attached 
> the first page of the created image as well as the original PDF.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to