---
title: "Add PDF functionality with Node.js | Nutrient Node.js SDK"
canonical_url: "https://www.nutrient.io/sdk/nodejs/getting-started/"
md_url: "https://www.nutrient.io/sdk/nodejs/getting-started.md"
last_updated: "2026-05-19T11:59:04.596Z"
description: "Integrate Nutrient dependency into a Node.js project. Convert Word, Excel, PowerPoint, and image files to PDF without external dependencies."
---

# Add PDF functionality with Node.js

This guide walks you through the steps necessary to integrate Nutrient dependency into a Node.js project.

## Requirements

- The [latest stable version of Node.js](https://nodejs.org/).

- A package manager compatible with [npm](https://docs.npmjs.com/about-npm). This guide contains usage examples for the [npm client](https://docs.npmjs.com/cli/v7/commands/npm). The npm client is installed with Node.js by default.

## Setting up a Node.js project

1. First, you need to have Node.js and npm (Node Package Manager) installed on your system. You can download Node.js from the [official website](https://nodejs.org/), and npm will be included.

2. Once you have Node.js and npm installed, you can verify the installation by running the following commands in your terminal:

   ```bash

   node -v
   npm -v
   ```

3. Now, navigate to the directory where you want to set up your project. Once you’re in the desired directory, initialize a new Node.js project by running:

   ```bash

   npm init -y
   ```

This command will create a new `package.json` file in your directory. The `-y` flag is used to accept the default values proposed by the questionnaire that usually follows `npm init`. If instead, you’d like to further define details of your project, you can omit the `-y` flag from the `npm init` command.

## Adding the Nutrient dependency

Open a terminal and move to the root directory of your Node.js project. Install the `@nutrient-sdk/node` library into your project by running the following command in your terminal:

```bash

npm install @nutrient-sdk/node

```

After running this command, `@nutrient-sdk/node` will be added to the list of dependencies in your `package.json` file.

At this point, you’re ready to develop your Node.js application using Nutrient Node.js SDK.

## Converting a document to PDF

1. Add an Office document or a PNG or JPEG image to your project directory. For this example, you’ll be converting a Word document. You can name it anything you want, but for the sake of this tutorial, call it `sample.docx`. Remember to update the file name in the following steps if you choose a different name.

2. Create a new JavaScript file in your project root directory. You can name it anything, but for this example, name it `index.js`.

3. In the `index.js` file, add the following code to import the `@nutrient-sdk/node` library and convert the document to PDF:

   ```js

   const { load } = require('@nutrient-sdk/node');
   const fs = require('node:fs');

   async function convertToPDF() {
       const docx = fs.readFileSync('sample.docx');
       const instance = await load({
    	   document: docx,
       });
       const buffer = await instance.exportPDF();
       fs.writeFileSync('converted.pdf', Buffer.from(buffer));
       await instance.close();
   }

   convertToPDF();
   ```

   At this point, the resulting PDF is converted but shows a Nutrient watermark. To convert documents without showing a watermark, specify a `license` property as part of the object passed as an argument to the `load()` function call containing `key` and `appName` properties — for example:

   ```js

   async function convertToPDF() {...
     const instance = await load({...
         license: {
           key: "LICENSE_KEY",
           appName: "APP_NAME"
         }
     });...
   };
   ```

[Contact Sales](https://www.nutrient.io/contact-sales/) for more information about obtaining a trial license key.

## Running the project

To run the script, navigate to your project directory in the terminal and run the following command:

```bash

node index.js

```

This will execute the `index.js` script, and a new `converted.pdf` file will appear in your filesystem.