Hi,
when trying to append attached docs signature.pdf (17.3 KB)
content.pdf (982.1 KB) aspose is throwing 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:49)
at com.aspose.pdf.PageCollection.m1(Unknown Source)
at com.aspose.pdf.PageCollection.add(Unknown Source)
at com.chitasys.PdfAppend.main(PdfAppend.java:49)
It is interesting it only happens when appending to signature.pdf but not other way around.
I tried this with v17.7 & v17.8
Code snippet:
// signature last
File outputFile2 = Paths.get(“d:\temp\pdfissue\joined-siglast.pdf”).toFile();
outputFile2.delete();
try (
InputStream is1 = new FileInputStream("d:\\temp\\pdfissue\\signature.pdf");
InputStream is2 = new FileInputStream("d:\\temp\\pdfissue\\content.pdf");
OutputStream os = new FileOutputStream(outputFile2)
) {
Document sig = new Document(is1);
Document doc = new Document(is2);
doc.getPages().add(sig.getPages());
doc.save(os);
}
// signature first - this one throws exception
File outputFile1 = Paths.get("d:\\temp\\pdfissue\\joined-sigfirst.pdf").toFile();
outputFile1.delete();
try (
InputStream is1 = new FileInputStream("d:\\temp\\pdfissue\\signature.pdf");
InputStream is2 = new FileInputStream("d:\\temp\\pdfissue\\content.pdf");
OutputStream os = new FileOutputStream(outputFile1);
) {
Document sig = new Document(is1);
Document doc = new Document(is2);
sig.getPages().add(doc.getPages());
sig.save(os);
}