---
title: "PDF-to-image JavaScript library | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/web/conversion/pdf-to-image/"
md_url: "https://www.nutrient.io/guides/web/conversion/pdf-to-image.md"
last_updated: "2026-06-09T10:25:14.532Z"
description: "With Nutrient Web SDK, you can render independent pages of a PDF document and save them as images. If the document contains any annotations."
---

# Convert PDFs to images using JavaScript

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

[Try for Free](https://www.nutrient.io/sdk/web/getting-started.md)

[Launch Demo](https://www.nutrient.io/demo/convert-pdf-to-image)

### Rendering and exporting a specific page as an image

The following example uses the [FileSaver.js](https://github.com/eligrey/FileSaver.js/) polyfill to save a single page as a PNG file to a computer by means of [`instance.renderPageAsImageURL()`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#renderPageAsImageURL):

```js

import { saveAs } from "file-saver";

const instance = await NutrientViewer.load({...otherOptions,
  document: "https://example.com/mydocument.pdf"
});

async function savePagePNG(pageIndex) {
  // Get page width.
  const { width } = instance.pageInfoForIndex(pageIndex);

  // Render page.
  const src = await instance.renderPageAsImageURL({ width }, pageIndex);

  // Save the image as a PNG.
  saveAs(src, `pdf-page-${pageIndex}.png`);
}

// Usage: Export page 3 as an image.
savePagePNG(3);

```
---

## Related pages

- [Headless file conversion](/guides/web/conversion/headless.md)
- [Convert images to text using JavaScript](/guides/web/conversion/image-to-text.md)
- [Convert images to PDFs using JavaScript](/guides/web/conversion/image-to-pdf.md)
- [Convert PDF to Office using JavaScript](/guides/web/conversion/pdf-to-office.md)
- [JavaScript PDF conversion library](/guides/web/conversion.md)
- [Convert scanned PDFs to searchable PDFs using JavaScript](/guides/web/conversion/scan-to-searchable-pdf.md)
- [Convert PDFs and images to PDF/A using JavaScript](/guides/web/conversion/to-pdfa.md)
- [Convert Office to PDF using JavaScript](/guides/web/conversion/office-to-pdf.md)
- [Convert text to PDF using JavaScript](/guides/web/conversion/text-to-pdf.md)

