@ANUTEJ Actully I searched From Many Different,,,unlike java or javascript or c#,,,apex don't have inbuild library function to convert a string to base6.....
Afetr My all Research i come to this conclusion,,,,,kindly check the code once it
public class PdfConvertingToBase6b {
public static void getTemplate() { RestRequest req = RestContext.request; RestResponse res = RestContext.response; PageReference pageRef = new PageReference('Quotes.pdf'); Blob pdf = pageRef.getContentAsPDF();
As you have stated only a single statement I tried searching and I was able to find below links that might be of help, can you try checking them once:
>>https://salesforce.stackexchange.com/questions/102823/converting-attached-pdf-into-base64
> https://developer.salesforce.com/forums/?id=906F00000009DKQIA2
Let me know if this helps.
Regards,
Anutej
Afetr My all Research i come to this conclusion,,,,,kindly check the code once it
public class PdfConvertingToBase6b {
public static void getTemplate() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
PageReference pageRef = new PageReference('Quotes.pdf');
Blob pdf = pageRef.getContentAsPDF();
String quoteId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Quote result =[SELECT Id, Name, Phone,email,(SELECT Id, Name FROM Attachments) FROM Quote WHERE ID = :quoteId];
//a.parentID = <quoteId>;
Account a = new account(name = 'test');
insert a;
Attachment attachmentPDF = new Attachment();
attachmentPdf.parentId = a.id;
attachmentPdf.name = a.name + '.pdf';
//attachmentPdf.body = Encodingutil.base64Encode(pdf);;
insert attachmentPDF;
}
}