IronPDF for Node.js - Create, Edit, and Read PDFs in Node.js Scripts

IronPDF is a PDF library that simplifies the effort needed to create and customize PDF documents programmatically using Node.js.

IronPDF has been developed by Iron Software, a company that maintains a growing suite of powerful, high-performance document processing libraries.

IronPDF is also available for use in .NET, Java, and Python.

Key Features of IronPDF for Node.js

  1. Generate PDFs from HTML, CSS, JavaScript, images, and other file types
  2. Add headers, footers, attachments, digital signatures, watermarks, and bookmarks to PDF documents
  3. Secure PDFs from unauthorized access with passwords, digital signatures, metadata, and other security settings
  4. Full multithreading and asynchronous support for optimal performance for mission critical applications

IronPDF has over 50 features for creating, formatting, and editing PDF documents.

Getting Started with IronPDF for Node.js

  1. Install Node.js: Download and install the latest version of Node.js from the official website.
  2. Install the @ironpdf package: Use the terminal command below to install IronPDF using NPM:

    npm i @ironsoftware/ironpdf
  3. Install the IronPDF Engine (optional): Install the appropriate binary for your operating system:

    For Windows x64:

    npm install @ironsoftware/ironpdf-engine-windows-x64

    For Windows x86:

    npm install @ironsoftware/ironpdf-engine-windows-x86

    For Linux x64:

    npm install @ironsoftware/ironpdf-engine-linux-x64

    For macOS x64:

    npm install @ironsoftware/ironpdf-engine-macos-x64

    For macOS/ARM:

    npm install @ironsoftware/ironpdf-engine-macos-arm64

    Tips
    Installing the IronPdfEngine binary is optional, because IronPDF downloads and installs the correct one for your system automatically when your Node.js project runs for the first time.

  4. Apply a License Key (optional): In your Node.js project, set the IronPdfGlobalConfig.licenseKey property with a valid license key to use IronPDF:

    import {IronPdfGlobalConfig} from "@ironsoftware/ironpdf";
    
    (async () => {
        // Input the license key
        const IronPdfConfig = {
            licenseKey: "IRONPDF-MYLICENSE-KEY-1EF01",
        };
    
        // Set the config with the license key
        IronPdfGlobalConfig.setConfig(IronPdfConfig);
    })();
    NODE.JS

    Please note
    A license key unlocks IronPDF's full collection of formatting and editing features and removes our tiled watermarks from your PDFs.

Using IronPDF for Node.js

Convert HTML to PDF

Use PdfDocument.fromHtml to convert raw HTML into PDFs. This method can work with a string containing HTML or a file path to an HTML document.

import {PdfDocument} from "@ironsoftware/ironpdf";

/* Convert an HTML String to a PDF */
const pdf_1 = PdfDocument.fromHtml("<h1>Hello world!</h1><p><small>A PDF brought to you by IronPDF for Node.js!</small></p>")
                         .then((pdf) => {
                            pdf.saveAs("./html-string-to-pdf.pdf");
                         });
await pdf_1;

/* Convert an HTML File to a PDF */
const pdf_2 = PdfDocument.fromHtml("./index.html")
                         .then((pdf) => {
                            pdf.saveAs("./html-file-to-pdf.pdf");
                         });
await pdf_2;
NODE.JS

Convert URL to PDF

PdfDocument.fromUrl fetches a web page's content by URL and converts it into a PDF.

import {PdfDocument} from "@ironsoftware/ironpdf";

/* Convert an HTML String to a PDF */
const pdf = await PdfDocument.fromUrl("https://ironpdf.com/nodejs/");
await pdf.saveAs("./url_to_pdf.pdf");
NODE.JS

Licensing & Support Available

IronPDF for Node.js is free to use in development and testing environments without a license key. When unlicensed, however, IronPDF will apply watermarks to your PDFs.

Purchase a license key to use IronPDF in production without any watermarking. Alternatively, apply for a free trial license to try IronPDF before you buy it.

For more support and inquiries, please ask our team.