Hi,
I am using pdf and pdf.kit to generate and merge multiple pdf files.
Here is part of my code where I am having issue.
Here is my xml template
java code:
Image img =(Image)section1.getObjectByID("imageID1");
img.getImageInfo().setFile("d:\\barcode.jpeg");
this is how I am saving the pdf to memStream.
MemStream ms = new MemStream();
pdf.save(ms);
byte[] b = ms.toArray();
ByteArrayInputStream byteStream = new ByteArrayInputStream(b);
List inStreams = new ArrayList();
inStreams.add(byteStream);
PdfFileEditor pdfEditor = new PdfFileEditor();
InputStream[] ins = new InputStream[inStreams.size()];
for(int i=0;i<inStreams.size();i++)
{
ins[i] = inStreams.get(i);
}
FileOutputStream outStream = new FileOutputStream("d:\\docName.pdf");
pdfEditor.concatenate(ins, outStream);
When there is only one pdf file then I am getting following exception
java.lang.IllegalArgumentException: Invalid image or template handle in PlaceImage method.
at aspose.pdf.figure.Aba.a(SourceFile:521)
at aspose.pdf.xml.Abi.a(SourceFile:729)
at aspose.pdf.xml.Aaj.a(SourceFile:630)
at aspose.pdf.xml.Aca.a(SourceFile:246)
at aspose.pdf.xml.Aci.a(SourceFile:545)
at aspose.pdf.xml.Abt.a(SourceFile:152)
at aspose.pdf.xml.Aas.a(SourceFile:100)
at aspose.pdf.xml.Aba.a(SourceFile:122)
at aspose.pdf.Pdf.save(SourceFile:1167) at aspose.pdf.Pdf.save(SourceFile:1113)
But if there are one file then I am not getting any exception.
Can you please tell what am I doing wrong. And why do we get that exception.
Thanks
Mamatha