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

Tilman Hausherr edited comment on PDFBOX-1664 at 8/21/13 2:55 PM:
------------------------------------------------------------------

I found the cause, it is a syntax error in the PDF file:

<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 32
/FontBBox [-177 -269 1123 866]
/Fontname /Helvetica-Bold
/ItalicAngle 0
/StemV 105
>>

The second "n" in /Fontname should be in capitals. If I correct it then it 
works fine. The Adobe PDF reference tells that it is case sensitive (page 46), 
although it seems that their viewer does render the "bad" file properly.
                
      was (Author: tilman):
    I found the cause, it is a syntax error in the PDF file:

<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 32
/FontBBox [-177 -269 1123 866]
/Fontname /Helvetica-Bold
/ItalicAngle 0
/StemV 105
>>

The "n" in /Fontname should be in capitals. If I correct it then it works fine. 
The Adobe PDF reference tells that it is case sensitive (page 46), although it 
seems that their viewer does render the "bad" file properly.
                  
> NullPointerException in PDType1Font.java
> ----------------------------------------
>
>                 Key: PDFBOX-1664
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1664
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.2, 2.0.0
>         Environment: XP
>            Reporter: Tilman Hausherr
>
> I get this with 1.8.2 with certain files:
> 17.07.2013 11:48:54.406 WARN  [main] 
> org.apache.pdfbox.util.PDFStreamEngine:567 - java.lang.NullPointerException
> java.lang.NullPointerException
>       at 
> org.apache.pdfbox.pdmodel.font.FontManager.normalizeFontname(FontManager.java:136)
>       at 
> org.apache.pdfbox.pdmodel.font.FontManager.getAwtFont(FontManager.java:82)
>       at 
> org.apache.pdfbox.pdmodel.font.PDType1Font.getawtFont(PDType1Font.java:240)
>       at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.drawString(PDSimpleFont.java:109)
>       at 
> org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:235)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:496)
>       at org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:45)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:554)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
>       at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:125)
>       at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:781)
>       at pdfboxpageimageextraction.ExtractImages.doPdf(ExtractImages.java:108)
>       at pdfboxpageimageextraction.ExtractImages.main(ExtractImages.java:67)
> The cause [as of 19.8.2013] is in PageDrawer.java:
>     awtFont = FontManager.getAwtFont(fd.getFontName());
> which fails because fd.getFontName() returns null.
> A fix (don't know if it is good or just the symptom) is to add this line 
> above:
>     if (fd.getFontName() != null)
> It happens with 1.8.2, and the 2.0.0 version that I downloaded on May 5th.
> I can't provide a file, because its confidential.
> [memo for me: it is file 287]

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to