+ Start a Discussion
Arul Bernard I 14Arul Bernard I 14 

I have a requirement where I want to merge two pdfs in to a single pdf

I have a requirement where I want to merge two pdf into a single pdf and attach the attachments to the custom object in Salesforce.

PageReference pdf = PageReference(/apex/FirstPDF?id='+ccId);
Blob contentPdf = pdf.getContent();
PageReference cadre = new PageReference('/apex/SecondPDF?id=' + ccId);
Blob b = cadre.getContentPdf(); String combinedPdf = EncodingUtil.convertToHex(contentPdf)+EncodingUtil.convertToHex(b);
Blob horodatagePdf = EncodingUtil.convertFromHex(combinedPdf);
Attachment attachment = new Attachment();
attachment.Body = horodatagePdf;
attachment.Name = String.valueOf('New pdf.pdf');
attachment.ParentId = ccId; insert attachment;
Raj VakatiRaj Vakati
Hi Arul , 

I don't think so this approach will work .. you need to use some third party APIs to do this work or some node js application

Yoruk esraYoruk esra
did you find a solution to merge please