0

How to convert string to pfd in Apex, I am sending pdf from SFDC to other application through REST Api, Pdf is not getting open in destination application.

1

You can use Visualforce for this, setting apex:page renderAs="pdf" or instead using PageReference getContentAsPDF. Either of these ensures that the data is the PDF file format. Adjust the CSS for the page to get the styling you want - see e.g. Creating Professional PDF Documents with CSS and Visualforce.

You will then need to encode that data as required by the "other application" and set the Content-Type header appropriately.

0

renderAs = "pdf" will not work in this scenario since i need to convert string to pdf in apex class.

Below is worked for me.

blob b = blob.toPDF(notebody); 

Thanks, Anil Kumar

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.