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 2014/05/26 14:31:02 UTC

[jira] [Closed] (PDFBOX-1759) NullPointerException when loading/saving a PDF

     [ https://issues.apache.org/jira/browse/PDFBOX-1759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr closed PDFBOX-1759.
-----------------------------------

    Resolution: Cannot Reproduce

The one with a password gives a CryptographyException. The others load. You have to use PDDocument.load() or loadNonSeq() to open documents.

> NullPointerException when loading/saving a PDF
> ----------------------------------------------
>
>                 Key: PDFBOX-1759
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1759
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.2
>         Environment: Ubuntu Linux & Windows 7 (both JDK6)
>            Reporter: William Palmer
>            Priority: Minor
>
> Loading and saving a PDF causes a NullPointerException:
> java.lang.NullPointerException
> 	at org.apache.pdfbox.pdmodel.PDPageNode.updateCount(PDPageNode.java:98)
> 	at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1319)
> 	at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1305)
> Files that cause this exception:
> https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_openpassword.pdf
> https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_notextaccess.pdf
> https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_noprinting.pdf
> https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_nocopy.pdf
> Code to reproduce:
> PDFParser parser = new PDFParser(new FileInputStream("file"));
> parser.parse();
> File temp = File.createTempFile("temp-", ".pdf");
> parser.getPDDocument().save(temp);
> parser.getDocument().close();
> I imagine the exception is thrown because the files have restrictions within them but I would not expect to get a NullPointerException if that is the case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)