+ Start a Discussion
mat_tone_84mat_tone_84 

join pdf email attachment

Hi,

I have a trigger that work properly for send email with attachments.

Now I need to create 1 pdf from 2 attachment, how can I join the blob of 2 attachments ?

I think : blob joinedpdf = att2.body & att3.body;

after that I will add attachment joinedpdf in the email, anyone can help me? 

thanks

 

attachment Att2 = [Select body, name from attachment where name like 'yyyy' and parentid = :az limit 1];    
document att3 =[select body,name from document where name = 'xxx' limit 1]; 

Messaging.EmailFileAttachment fileAttachment2 = new Messaging.EmailFileAttachment();
fileAttachment2.setBody(att2.body);
fileAttachment2.setFileName('test.pdf');
fileAttachments.add(fileAttachment2);

Messaging.EmailFileAttachment fileAttachment3 = new Messaging.EmailFileAttachment();
fileAttachment3.setBody(att3.body);
fileAttachment3.setFileName('test2.pdf');
fileAttachments.add(fileAttachment3);