Getting an exception when trying to stitch two pdf files together

Using the fallowing call I am getting ian exception when trying to concatenate one pdf to to another. however when loaded on their own, they load. also if I load the hsa document first and try to concatenate it to the invoice. the first pdf loads, but the second page of the invoice does not load


oldDocument.getPages().add(document.getPages());

class com.aspose.pdf.internal.ms.System.z72: List contains object of invalid type
com.aspose.pdf.PageCollection.m1(Unknown Source)
com.aspose.pdf.PageCollection.add(Unknown Source)

also getting the following on other documents that are put together
at com.aspose.pdf.facades.APdfFileEditor.validateAnotations(Unknown Source)
at com.aspose.pdf.ADocument.saveInternal(Unknown Source)
at com.aspose.pdf.Document.saveInternal(Unknown Source)
at com.aspose.pdf.ADocument$1.m1(Unknown Source)
at com.aspose.pdf.internal.p719.z2.m2(Unknown Source)
at com.aspose.pdf.internal.p719.z3.m1(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)

Hi Mark,


Thanks for contacting support.

I have tested the scenario using latest release of Aspose.Pdf for Java 11.2.0 using Eclipse Mars project with JDK 1.8.0 running over Windows 8.1 and I am unable to notice any issue. As per my observations, the PDF files are properly being concatenated in both scenarios mentioned above. For your reference, I have also attached the output generated over my end. Please take a look.

Can you please try using the latest release and in case the issue still persists, please share some details regarding your working environment i.e. Operating System, JDK version etc.

We are sorry for your inconvenience.