This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/pdf-generation/thumbnail-preview.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Generate PDF thumbnails using JavaScript library | Nutrient

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

Saving a page as an image

Nutrient Web SDK’s renderPageAsImageURL method renders the page as an image and returns a URL you can use to fetch that image’s contents:

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(opens in a new tab) library:

Terminal window
npm install file-saver
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);
}