Free Support Forum - aspose.com

Exception when joining 2 pdf files

Hello,

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);
sig.getPages().add(doc.getPages());

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

I get following exception:
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)
com.chitasys.PdfAppend.main(PdfAppend.java:23)
at com.aspose.pdf.PageCollection.m1(Unknown Source)
at com.aspose.pdf.PageCollection.add(Unknown Source)
at com.chitasys.PdfAppend.main(PdfAppend.java:23)


Thanks,
martin
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.

Thanks,
Nick

@npichetto,

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,
Nick

@npichetto,

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

@imran.rafique,

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.

Thanks,
Nick

@npichetto,

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.