Convert a DOCX to PDF in Salesforce Apex

Let’s be real; Microsoft Word may be the go-to for creating and editing business documents, but it’s not exactly the prettiest or most presentable format. When it comes to presentability, PDF files win every time; they are tough to edit, so clients won’t modify the documents, and formatting from the original document can transfer seamlessly. The following API will make automatically converting DOCX files to PDFs a cinch.

To use the API in Apex, you will first need to download and copy the /client folder into your Apex project:

Download Apex Client

For the next step, you can call the function with the following code:

That’s it! The returned response will provide you with your newly created PDF file. To retrieve your API key, simply head to the Cloudmersive website to register for a free account and gain access to 800 monthly calls.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store