Free Support Forum -

Exception when joining 2 pdf files


when trying to join attached files using this snippet using latest aspose-pdf v17.4:

InputStream is1 = new FileInputStream(“d:\temp\pdfissue\signature.pdf”);
InputStream is2 = new FileInputStream(“d:\temp\pdfissue\content.pdf”);

Document sig = new Document(is1);
Document doc = new Document(is2);

OutputStream os = new FileOutputStream(“d:\temp\pdfissue\joined.pdf”);;

I get following exception:
class List contains object of invalid type
com.aspose.pdf.PageCollection.m1(Unknown Source)
com.aspose.pdf.PageCollection.add(Unknown Source)
at com.aspose.pdf.PageCollection.m1(Unknown Source)
at com.aspose.pdf.PageCollection.add(Unknown Source)
at com.chitasys.PdfAppend.main(

Hi Martin,

Thanks for using our API's.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFJAVA-36771 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Is there an update on this? I am seeing a similar exception in my code.



The linked ticket ID PDFJAVA-36771 is not resolved yet, and we will notify you once it is fixed. We recommend our clients to share each problematic document for the testing purposes, so that their scenario will also be verified after the fix of root cause. Please send us your source PDF documents and code. We will investigate your scenario in our environment, and share our findings with you.

Hi @imran.rafique,

Thanks for your response. It appears there may have been a problem with the files we were trying to concatenate. Even though we were able to open the .pdf files in Adobe with no problem, we had issues displaying them with Aspose. After altering and re-saving them, we had no further issues.

Thank you,


Please send us your problematic PDF documents for the testing purposes. Your response is awaited.


I’m sorry, but these are customer documents, not ours, and contain sensitive data. If I find a document that fails to load and that we can share, I will forward them to you ASAP.



We use source files for testing purposes only. We also recommend our clients to remove the sensitive data. You may add dummy data in place of the sensitive data or share the confidential files in private message.