Convert Word DOCX Document to PDF in C#

Take advantage of simple, copy & paste code from the Cloudmersive API Console to harness one of the most in-demand document conversion operations out there. Check out how to connect in C# below.

First, install the .NET Framework SDK:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.4.2

After that, copy & paste the rest of the callback function. Make sure to include your Cloudmersive API key within the snippet Configuration.Default.AddApiKey(“Apikey”, “YOUR_API_KEY”). If you don’t currently have a key, you can easily get one by making a free account on the Cloudmersive website.

using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;
namespace Example
public class ConvertDocumentDocxToPdfExample
public void main()
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new ConvertDocumentApi();
var inputFile = new System.IO.FileStream("C:\\temp\\inputfile", System.IO.FileMode.Open); // System.IO.Stream | Input file to perform the operation on.
// Convert Word DOCX Document to PDF
byte[] result = apiInstance.ConvertDocumentDocxToPdf(inputFile);
catch (Exception e)
Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentDocxToPdf: " + e.Message );




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Be a GitHub Contributor in Five Minutes

Migrating Sessions in PHP

Why Babies Are More Resilient Against Covid-19

There Is No Age Restriction for Doing What You Love to do.

How python is special in Today's world

Flutter + Kotlin Multiplatform, Write Once Run Anywhere

CS373 Spring 2022: Jonathan Li: Final Entry

TwitterTrack — tracking tweets using Tweepy #BeginnerProject

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


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

More from Medium

Perform Text-to-Speech on a String in C#


Pangram in C#

What is Middleware?