Convert DOC to PDF with NET REST API

This basic topic guides on how to convert DOC to PDF with NET REST API. You will make use of the Aspose.Words for .NET Cloud SDK to transform DOC to PDF with C# Low Code API by following the detailed steps and an example code. You will also be enlightened with various customizations that can be applied during the conversion process.

Prerequisite

Steps to Change DOC to PDF with C# REST API

  1. Set Client ID and Client Secret for the API in the Configuration class object to convert DOC to PDF
  2. Instantiate an object of the WordsAPI class using the Configuration object
  3. Set the input DOC and desired output PDF file names
  4. Read the source DOC file into a FileStream object and
  5. Create an instance of the ConvertDocumentRequest object with the FileStream and output format
  6. Invoke the ConvertDocument function by using the ConvertDocumentRequest object
  7. Save the converted PDF file on the local disk

The steps above transform the file type from DOC to PDF with C# Low Code API. We will begin with the initialization of the configuration of the SDK by creating the WordsApi class object. We will then access the source DOC file using a FileStream and create the ConvertDocumentRequest class object that is further used for performing the conversion to a PDF using the ConvertDocument() method.

Code to Convert DOC File to PDF with NET REST API

The example code demonstrates the process of converting a DOC file to PDF with C# REST API. It is not mandatory to instantiate a Configuration object first as you may also create the WordsApi object directly by providing the Client ID and Client secret in another overloaded constructor. You can also customize the conversion process by setting various arguments during the ConvertDocumentRequest object that are set to null by default in this sample code.

If you are interested in DOCX to MD file conversion, you may check out how to convert DOCX to MD with NET REST API.

 English