We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NullPointerException in Aspose PDF version 10.4.0

Hi,


Trying to do some test with a lot of PDF files, i found a NullPointerException with specific file (see file attachment: bug-sample.pdf)

The code:

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.InputStream;


import com.aspose.pdf.Document;

import com.aspose.pdf.Page;

import com.aspose.pdf.PageCollection;

import com.aspose.pdf.devices.JpegDevice;

import com.aspose.pdf.devices.Resolution;

public class TestNullPointerException {

public static void main(String[] args) throws Throwable {

try(InputStream input = new FileInputStream(new File("./bug-sample.pdf"))){

Document document = new Document(input);

try(FileOutputStream out = new FileOutputStream(new File("./thumb.jpeg"))){

PageCollection pages = document.getPages();

Page page = pages.get_Item(1);

page.flatten(); //NullPointerException here!!!

page.sendTo(new JpegDevice(new Resolution(100)), out);

}catch(Exception e){

e.printStackTrace();

}finally{

document.close();

document.dispose();

}

}

}

}

/*
output:

java.lang.NullPointerException

at com.aspose.pdf.Page.m2(Unknown Source)

at com.aspose.pdf.Page.flatten(Unknown Source)

at TestNullPointerException.main(TestNullPointerException.java:20)


Environment:
JRE: 1.8.0.45
OS X 10.9.5

*/

Hi there,

Thanks for your inquiry. I have tested your scenario with shared document using Aspose.Pdf for Java 10.4.0 and managed to observe the reported exception. For further investigation, I have logged an issue in our issue tracking system as PDFNEWJAVA-34972 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
Calibri;color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA”>Best Regards

The issues you have found earlier (filed as PDFNEWJAVA-34972) have been fixed in Aspose.Pdf for Java 16.12.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.