This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/nodejs/conversion/image-to-pdf.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Convert image to PDF in Node.js: JPG, PNG, more | Nutrient

Nutrient Node.js SDK enables you to convert images to PDF documents. For more information on the supported image formats, see the list of supported file types.

The example below loads an image and exports it to a PDF:

import fs from "node:fs";
import { load } from "@nutrient-sdk/node";
const pngImage = fs.readFileSync("source.png");
const instance = await load({ document: pngImage });
const buffer = await instance.exportPDF();
fs.writeFileSync("converted.pdf", Buffer.from(buffer));
await instance.close();