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

With Nutrient Node.js SDK, you can render independent pages of a PDF document and save them as images. If a document contains any annotations, they’ll be rendered over the page background.

Rendering and exporting a specific page as an image

The following example saves a single page from a document as a PNG file:

import fs from "node:fs";
import { load } from "@nutrient-sdk/node";
const doc = fs.readFileSync("source.pdf");
const instance = await load({ document: doc });
const pageWidth = instance.getDocumentInfo().pages[0].width;
const result = await instance.renderPage(0, { width: pageWidth });
fs.writeFileSync("page.png", Buffer.from(result));
await instance.close();

By default, the image will be exported as PNG. You can choose to export it to WebP instead by modifying the call to instance.renderPage() as follows:

const result = await instance.renderPage(
0,
{ width: pageWidth },
"webp"
);