You need to sign in to do that
Don't have an account?

PDF content as String ?
I want to get pdf file content as string in apex, currently i don't see any option? how do I get raw pdf back with all formats like '%PDF', "%%EOF", "trailer"
All the pdf data i'm getting from content, document, visulaforce render as pdf are mostly blob or base64 format, but when i try to convert them into string using encoding util class, i can't able to get the raw pdf file as i epxect,
any help?
Thanks
Ram
I am guessing you are tryng to save the PDF as DOcument or Quotedocument, attachment or some other custom object. All you have to do is use getcontent or get contectasPDF methoods in Salesforce and store it as a blob.
pr = New PageReference('/apex/ReportPDF?id=' + id );
pdf = pr.getContentAsPDF();
Attachment a = New Attachment();
a.body = pdf;
a.parentID = <parent object id>;
a.Name = 'FSA.pdf';
insert a;
Hopefully this example helps...
I want the other way around, I'm retriveing a contentversion or getting page conent as pdf, but all i'm getting is blob object, there is no way for me to get back the raw pdf as string
Thanks
Ram
If your intent is saving the PDF content then you use the logic I provided may I know why u want the content as String.
If you convert using String.ValueOf(<BLod>); but this will make the content miserable...
if you want to send a pdf content to outside webservices you might face this issue,, its requirements not a question of whats possible,
let see what the other ideas around the community ?
Thanks
Ram
Were you able to get a solution for this? I am also facing the same situation. Please provide ur solution.
Thanks in advance.