function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alin Mocanu 6Alin Mocanu 6 

Convert Word to PDF from Apex

Hello,

Do you have any idea how can I convert Salesforce Word Files into PDF from apex? There are pretty complex documents and I need a solution that will not crash. Maybe some free AppExchange solution which you used?

Thank you
AbhishekAbhishek (Salesforce Developers) 
Alin,

What you can try is that you can create a PDF file from the attachments that get created on the case. So that way you can have an Original File (maybe a word document) and a new file (PDF version). You can try to write this logic in Trigger on the attachment object. 

Try the examples and suggestions as mentioned below,

https://medium.com/@cloudmersive/how-to-convert-word-docx-to-pdf-in-apex-66032324c08

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_renderas_pdf.htm

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_blob.htm


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Alin Mocanu 6Alin Mocanu 6

The first solution seems to complicated to understand and to use.. I just want to pass the contentDocumentId and to get the return Blob as pdf.

The other 2 are not working. I heard that, from the last release, there are restrictions for the render. Blob.toPdf is not working well.

Trail headTrail head
Hi, Did you got the Solution for this.Can you please post the answer.
Thank you