cancel
Showing results for 
Search instead for 
Did you mean: 

Merge embedded base64 pdf documents

Former Member
0 Kudos

Hello,

In the XML payload there could be 1..N embedded PDF files in base64 format. I need to merge all of the PDF files so that the output will only create one PDF file. I did test to manually merge two embedded strings together in an XML file, but that did not create the PDF with both documents in it. Anyone know how to correctly merge two embedded PDF files in a mapping?

Thanks,

Per

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you for your replies. I agree this is a java task. The information provided handles merging "real" PDF files and not embedded files. Hopefully one can merge the embedded files without decoding them to PDF first.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

IMO, Doing using java mapping is simpler than UDF in this case. You basically need to read each attachments and then merge into one file or document. The below link provides the solution to read individual files and merge together as one document as final output.

http://www.mindfiresolutions.com/Java-Merging-multiple-PDFs-into-a-single-PDF-using-iText-671.php

http://sanjaal.com/java/tag/combine-multiple-pdfs-into-one-in-java/

http://www.roseindia.net/java/itext/Comboine2page.shtml

former_member184681
Active Contributor
0 Kudos

Hi Per,

Definitely what you're trying to achieve is more a Java development requirement than PI-related problem. From PI's perspective, this should be easy: simply call a UDF that will read the attachments from XML tags and combine the pdfs. But the difficulty is to write the Java code that will combine the UDFs. Simple concat won't work here, since you have to think of format-specific header and trailer parts. Try googling on this or post your thread in the Java development forum to get better response. Example implementation: http://stackoverflow.com/questions/3585329/how-to-merge-two-pdf-files-into-one-in-java

Regards,

Greg