Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

NullPointerException when saving PDF

$
0
0
Hello I'm getting:
java.lang.NullPointerException
        at com.aspose.e.h.a(Unknown Source)
        at com.aspose.pdf.ADocument.preSave(Unknown Source)
        at com.aspose.pdf.ADocument.saveInternal(Unknown Source)
        at com.aspose.pdf.Document.saveInternal(Unknown Source)
        at com.aspose.pdf.ADocument.a(Unknown Source)
        at com.aspose.pdf.ADocument.save(Unknown Source)
        at com.aspose.pdf.Document.save(Unknown Source)
        at dk.dubu.documents.pdf.PDFUtils.mergePdfs


My mergePdfs method looks like this :
            Document doc = new Document();
            Document.setLocalFontPath("/usr/lpp/X11/lib/X11/fonts/TrueType/");

            for(InputStream file: inputFiles) {
                Document pdf = new Document(file);
                doc.getPages().add(pdf.getPages());
                doc.updatePages();
            }
           
            doc.save("/home/user/out.pdf");

And in the doc.save line the exception occurs, is there any problem with the code?

Viewing all articles
Browse latest Browse all 3131

Trending Articles