Hi Tilal,
Has this issue been fixed? We are facing a similar problem in Aspose PDF for Java 4.5 for PDFPortfolio functionality. It works as expected when we run it in Windows environment. However, when we deploy the same code in Ubuntu Linux 10.04, null pointer exception is thrown at doc.save() line. Appreciate your response.
Thank you,
Ashok
Code snippet attached below for reference:
com.aspose.pdf.Document doc = new com.aspose.pdf.Document();
doc.setCollection(new com.aspose.pdf.Collection());
String fileName="";
String out_file="";
try {
for (int i=0; i<key.size();i++)
{
fileName = dir_name + "rmp_fellows_" + i + ".pdf";
ReadPdfFromUrl(key.get(i), fileName);
File f = new File(fileName);
System.out.println("f.exists() - " + f.exists());
com.aspose.pdf.FileSpecification pdf = new com.aspose.pdf.FileSpecification(fileName);
pdf.setDescription("Pdf File"+i);
doc.getCollection().add(pdf);
}
out_file = new java.util.Date().getTime()+ ".pdf";
System.out.println("# of pages :" + doc.getPages().size());
doc.save(out_dir_name+out_file);
System.out.println("Portfolio saved in " + out_file);
Exception:
java.lang.NullPointerException
at com.aspose.g.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.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at org.ieee.pdfportfolio.PDFPortfolioResource.getKeys(PDFPortfolioResource.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)