You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2013/07/17 12:04:53 UTC

[jira] [Created] (PDFBOX-1664) NullPointerException in PDType1Font.java

Tilman Hausherr created PDFBOX-1664:
---------------------------------------

             Summary: 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 is in PDType1Font.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.

--
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