Julian Isaac created PDFBOX-4346:
------------------------------------
Summary: NPE on calling save()
Key: PDFBOX-4346
URL: https://issues.apache.org/jira/browse/PDFBOX-4346
Project: PDFBox
Issue Type: Bug
Affects Versions: 1.8.16, 1.8.10
Reporter: Julian Isaac
Opening a PDF file, making some changes to the metadata (set Producer,
Creator), then calling save(String fileName) results in null pointer exception
(on some PDFs).
java.lang.NullPointerException
at org.apache.pdfbox.pdmodel.PDPageNode.updateCount(PDPageNode.java:100)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1364)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1350)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1337)
at my.modules.utils.MetaDataUpdater.save(MetaDataUpdater.java:146)
It's a maven project and the version of PDFBox I'm using is 1.8.16. I'm trying
to save back to the same file as the one I've opened...
Not sure why it's trying to update the page count when all I'm changing is the
metadata?
Seems this returns null which means the page instance variable is null,
resulting in the NPE when page.setLong() is called...
public PDPageNode getPages()
{
return new PDPageNode( (COSDictionary)root.getDictionaryObject(
COSName.PAGES ) );
}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]