Isaac Maw
Technical Content Creator
Published July 30, 2025
Updated August 05, 2025
4 min
How to Convert DOCX Files to PDF with Node.js
Isaac Maw
Technical Content Creator

Summary: Convert DOCX files to PDF using Apryse’s Server SDK in Node.js without third-party dependencies. This guide walks through setup, licensing, and sample execution.
Applications with DOCX to PDF conversion for documents like invoices are in high demand. With the Apryse Server SDK for Node.js, developers can develop an app with this feature to convert DOCX files like templates, no matter the size, with the help of Node.js, without any external third party dependencies.
Get Started with Server SDK on Node.js
To convert documents from PDF to DOCX in Node.js, we’ll use our Server SDK. We can try it using a trial key. Your trial includes unlimited trial usage and support from solution engineers.
Prerequisites
- Windows (64-bit)
- Node.js Version: 8 - 22
Install the NPM Package
Install the npm package:
Please note that all Apryse NodeJS libraries install native binaries and installing the package will install a system specific distribution.
npm i @pdftron/pdfnet-node Run the samples
The samples are not included with the pdfnet-node package, and need to be downloaded separately.
Step 1 - Download the samples
Open a command line console, and run:
npm i @pdftron/pdfnet-node-samplesStep 2 - Navigate to the folder where the samples are located
Change the directory to the node_modules/@pdftron/pdfnet-node-samples folder
Step 3 - Add the license key to the sample
You can get your trial key on our documentation page. Please note that the trial key is uniquely generated and should not be shared publicly (eg. On your public github)
The Apryse SDK requires a license key. Open the file LicenseKey.js, and paste the license key into it.
Step 4 - Run the samples
While you can run samples individually, you can also run all of them together using a script that is in package.json.
npm run test If you want to run a sample individually, then navigate to its folder, then use node to run the JavaScript file. For example, here's how to run the AddImageTest sample:
cd ./AddImageTest
node AddImageTest.jsIntegrate into your project
You can now import the Apryse SDK by using the following in your Node.js code:
const { PDFNet } = require('@pdftron/pdfnet-node');At the end of your code, don't forget to call PDFNet.shutdown(), otherwise your Node.js program will keep hanging.
You can also find these instructions in our documentation for getting started with the Apryse Server SDK for Node.js.
Converting DOCX to PDF for Node.js with No External Third Party Dependencies
Now that you’re all set with the Server SDK, you can run the below sample to convert your DOCX to PDF with this code:
For a full sample on PDF conversion, check out https://docs.apryse.com/core/samples/officetopdftest
Next Steps
In addition to document conversion, the Apryse Server SDK is your solution for providing PDF viewer, annotations, text extraction, search, form filling, and more. Check out our Server SDK information page to learn more. When you’re ready to get started, contact sales.


