---
title: "Generate PDF thumbnails using JavaScript library | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/pdf-generation/thumbnail-preview/"
md_url: "https://www.nutrient.io/guides/web/pdf-generation/thumbnail-preview.md"
last_updated: "2026-05-28T17:47:04.481Z"
description: "In addition to rendering PDFs in the viewer, you can use Nutrient Web SDK to render single PDF pages as images. This can be useful when you want to."
---

# Generate PDF thumbnails using JavaScript

In addition to rendering PDFs in the viewer, you can use Nutrient Web SDK to render single PDF pages as images. This can be useful when you want to, for example, display a thumbnail of a single page of a PDF.

## Saving a page as an image

Web SDK’s [`renderPageAsImageURL`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#renderPageAsImageURL) method will render the page as an image and return a URL that can be used to fetch the contents of that image:

```js

try {
  const instance = await NutrientViewer.load(myConfiguration);
  const src = await instance.renderPageAsImageURL({ width: 400 }, 0);
} catch (error) {
  console.error("Failed to load document:", error.message);
}

```

To increase the quality of the resulting image, you can provide a greater `width` value — e.g. `400 * window.devicePixelRatio`.

After this, you can save a single page as a PNG file to your users’ computers using the [FileSaver.js](https://github.com/eligrey/FileSaver.js/) library:

```bash

npm install file-saver

```

```js

import { saveAs } from "file-saver";

try {
  const instance = await NutrientViewer.load(myConfiguration);

  // Renders the first page (page index 0).
  const src = await instance.renderPageAsImageURL({ width: 2000 }, 0);
  saveAs(src, "pdf-page.png");
} catch (error) {
  console.error("Failed to load document:", error.message);
}

```
---

## Related pages

- [Generate a PDF with a PDF form using JavaScript](/guides/web/pdf-generation/from-pdf-form.md)
- [Headless PDF generation](/guides/web/pdf-generation/headless.md)
- [Generate PDFs from a Word template using JavaScript](/guides/web/pdf-generation/from-word-template.md)
- [JavaScript PDF generation library](/guides/web/pdf-generation.md)
- [Generate PDFs from images using JavaScript](/guides/web/pdf-generation/from-images.md)
- [Generate PDF reports using JavaScript](/guides/web/pdf-generation/pdf-reports.md)
- [Generate PDFs from a template using JavaScript](/guides/web/pdf-generation/from-pdf-template.md)

