Konstantin Kakunin created PDFBOX-2803:
------------------------------------------
Summary: NullPointerException into class PDType0Font
Key: PDFBOX-2803
URL: https://issues.apache.org/jira/browse/PDFBOX-2803
Project: PDFBox
Issue Type: Bug
Reporter: Konstantin Kakunin
I find error on trunk (from 12 May 2015 )
Exception in thread "main" java.lang.NullPointerException
at
org.apache.pdfbox.pdmodel.font.PDType0Font.willBeSubset(PDType0Font.java:150)
at
org.apache.pdfbox.pdmodel.PDPageContentStream.setFont(PDPageContentStream.java:304)
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:295)
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.createAppearanceContent(AppearanceGeneratorHelper.java:227)
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:202)
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGenerator.generateFieldAppearances(AppearanceGenerator.java:61)
at
org.apache.pdfbox.pdmodel.interactive.form.PDField.updateFieldAppearances(PDField.java:110)
at
org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:286)
at pdftext.my_main.main(my_main.java:74)
For me, I fixed error as:
/**
* Constructor for reading a Type0 font from a PDF file.
*
* @param fontDictionary The font dictionary according to the PDF
specification.
*/
public PDType0Font(COSDictionary fontDictionary) throws IOException
{
super(fontDictionary);
COSArray descendantFonts =
(COSArray)dict.getDictionaryObject(COSName.DESCENDANT_FONTS);
COSDictionary descendantFontDictionary = (COSDictionary)
descendantFonts.getObject(0);
if (descendantFontDictionary == null)
{
throw new IOException("Missing descendant font dictionary");
}
descendantFont =
PDFontFactory.createDescendantFont(descendantFontDictionary, this);
readEncoding();
fetchCMapUCS2();
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PDType0Font parentFont = PDType0Font.load(new PDDocument(), new
File("c:\\Windows\\Fonts\\arial.ttf")); //kostya!!!!
embedder = parentFont.embedder; //kostya!!!!
}
--------------------
embedder has not been initialized in
public PDType0Font(COSDictionary fontDictionary) throws IOException
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]