---
title: "Node.js PDF to image: Convert PDF to JPG, PNG, more | Nutrient"
canonical_url: "https://www.nutrient.io/guides/nodejs/conversion/pdf-to-image/"
md_url: "https://www.nutrient.io/guides/nodejs/conversion/pdf-to-image.md"
last_updated: "2026-05-23T00:08:18.139Z"
description: "Learn how to export PDF pages as PNG or WebP images using Nutrient Node.js SDK, including handling annotations seamlessly."
---

# Convert PDFs to images in Node.js

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:

```js

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:

```js

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

```

---

## Related pages

- [Convert image to PDF in Node.js](/guides/nodejs/conversion/image-to-pdf.md)
- [PDF conversion library for Node.js](/guides/nodejs/conversion.md)
- [Convert MS Office files to PDF in Node.js](/guides/nodejs/conversion/office-to-pdf.md)

