Free Support Forum -

Error when setting PageHeight/PageWidth


if I’m setting PageHeight and PageWidth in the Pdf document, there is a NullPointerException:

Pdf pdf = new Pdf();
Section section = pdf.getSections().add();
section.getParagraphs().add(new Text(“Hello World”));“C:\temp\test.pdf”);

Exception in thread “main” java.lang.NullPointerException
at aspose.pdf.xml.Ack.a(SourceFile:2538)
at aspose.pdf.xml.Ack.a(SourceFile:2472)
at aspose.pdf.xml.Acm.a(SourceFile:494)
at aspose.pdf.xml.Ack.a(SourceFile:2467)
at aspose.pdf.xml.Acm.a(SourceFile:494)
at aspose.pdf.xml.Acc.a(SourceFile:784)
at aspose.pdf.xml.Aar.a(SourceFile:97)
at aspose.pdf.xml.Aba.a(SourceFile:112)

The same Exception occurs when I set the height and width of section.getPageInfo().
Tested with 2.8.0 and 2.9.0.

Hello Igor,

Thanks for using our products.

I have tested the scenario and I am able to notice the same problem. I wonder how we missed this basic workflow during our testing. For the sake of correction, I have logged it as PDFJAVA-28846 in our issue tracking system and will further look into the details of this problem. Soon you will be updated on the status of correction. We apologize for your inconvenience.


there is another Exception when I am trying to compile the code above, maybe this helps you to reproduce the exception:

Pdf pdf = new Pdf();
Section section = pdf.getSections().add();

section.getParagraphs().add(new Text(“Hello World”));“C:\temp\test.pdf”);

Exception in thread “main” java.lang.StackOverflowError
at java.util.ArrayList.indexOf(
at aspose.pdf.Sections.indexOf(SourceFile:164)
at aspose.pdf.xml.Abt.a(SourceFile:936)
at aspose.pdf.xml.Abt.a(SourceFile:398)
at aspose.pdf.xml.Abt.b(SourceFile:649)

If you remove the line
section.getParagraphs().add(new Text(“Hello World”));
there is no error.

Hello Igor,

Thanks for sharing the information.

I am able to notice the same problem and have logged this scenario with already logged issue. We will definitely consider it during the resolution of this problem. Please be patient and spare us little time. We apologize for your inconvenience.

Okay thanks, I just mentioned it because of the issue status ( 28846 (Cannot Reproduce) )

Hello Igor,

The status is marked as Cannot Reproduce because we are unable to notice it with current code repository. The issue is occurring in v2.9.0 but it seems to be fixed in later code. However we will definitely check the scenario that you have shared in previous post. Soon you will be updated with the status of correction. We apologize for your inconvenience.

Okay thanks.
Maybe there is an posibility to access the snapshot? We are waiting for this and two other fixes, which are already resolved. Or is there a schedule for the next release?

Thany you.

Hello Igor,

Thanks for your patience.

I will check with the development team to get some information regarding the timelines by which the new version will be released. As soon as I have some updates, I will let you know. Please be patient and spare us little time.


Thanks for your patience.

As per our current estimates, we plan to release the product before the end of this month (July02011) but still it's not a promise. We will try our level best to publish it ASAP. Your patience and comprehension is greatly appreciated in this regard. We apologize for the delay and inconvenience.