[ https://issues.apache.org/jira/browse/PDFBOX-4346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653793#comment-16653793 ]
Tilman Hausherr commented on PDFBOX-4346: ----------------------------------------- Please attach the PDF file. Try also opening the PDF file with loadNonSeq instead of load. > 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.10, 1.8.16 > Reporter: Julian Isaac > Priority: Major > > 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: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org