I'm encrypting LiveChat Transcript body using integration with Skyhigh and storing it in the record. After that I'm trying to insert this as an attachment.
Problem: Body is getting stored as in encrypted format say something like this
But when I try to insert as an attachment it only stores the character.
Code for this is
String pdfContent = '' + FORM_HTML_START;
String cent = 'center';
String pdfContentUCSW = '';
try
{
System.debug('Encrypted Body :'+encryptedBody);
pdfContent = '' + FORM_HTML_START;
pdfContent = pdfContent + '<H2 align="center">Chat Transcript</H2>';
pdfContent = pdfContent + '<P style="font-family: Arial Unicode MS;">' +encryptedBody+ '</P>';
pdfContentUCSW = pdfContent+'<P>'+chats.Body+'</P>';
pdfContent = pdfContent + FORM_HTML_END;
pdfContentUCSW = pdfContentUCSW + FORM_HTML_END;
System.debug('Pdf --> :'+pdfContent); //here it shows the encrypted data
Attachment attachmentPDF = new Attachment();
attachmentPDF.parentId = chats.Id;
attachmentPDF.Name = chats.Name + '.pdf';
// attachmentPDF.ContentType = 'application/pdf;charset=UTF-8;';
//System.debug(Blob.toPDF(pdfContent).toString());
//Blob.valueOf(pdfContent);
attachmentPDF.body = Blob.toPdf(String.valueOf(pdfContent)); //This creates the PDF content
insert attachmentPDF;
}
How can I overcome this?