One of the popular and necessary task in working with documents is saving these files in PDF format. We call it as document conversion. Document conversion is the conversion of file types from one document format to another.

Since documents may contain texts, images, embedded fonts, hyperlinks, signatures etc, a reliable converter must maintain layout in target format. Also a converter shall convert a large number of documents at once.

Document Conversion Suite (DCS) is a cloud service allows you to successfully, quickly and easily convert your documents to the most popular formats and vice versa. Personally I’ve been actively using it for more than 10 years, thanks to reliability of service. DCS provides both synchronous and asynchronous methods to developers. I strongly suggest using asynchronous approach due to nature of conversion lifecycle and to bypass connection timeout limitation of gateway platform.

Asynchronous approach is so simple to implement. You only need to send source documents to SubmitTIFFConversionTask or SubmitPDFConversionTask API methods to receive task identifier as response. There is also SubmitDOCXConversionTask method to convert PDF documents to editable Microsoft Word document.

After receiving task identifier you need to check task status by calling GetConversionTaskStatus method. You need to call same method after a few seconds delay as long as task status equals to “Waiting”. Once you receive “Completed” from GetConversionTaskStatus method you can break loop and call DownloadResult method to download final document file. Conversion workflow is illustrated in the diagram below.

Illustration 1: File Conversion Workflow

Step 1. Obtain your token

To make the API calls, you need a valid access token. We will send access token in http headers. You may obtain your access token by creating app for cloud API.

Step 2. Implement and iterate asynchronous approach

DCS accepts HTTP Form post requests. It was popular approach in early 2000s. Here I’ve listed client implementations in various programming languages.

How to Convert Documents to PDF by Using Python

How to Convert Documents to PDF by Using C#

How to Convert Documents to PDF by Using Java

How to Convert Documents to PDF by Using Visual Basic

How to Convert Documents to PDF by Using Go Lang

How to Convert Documents to PDF by Using PHP