---
title: "Converting PDF documents to image format | Nutrient Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/conversion/pdf-to-image/"
md_url: "https://www.nutrient.io/guides/java/conversion/pdf-to-image.md"
last_updated: "2026-06-09T21:11:56.021Z"
description: "Convert PDF documents to images using Nutrient Java SDK."
---

# Converting PDF documents to image format

Convert PDF documents to image files when you need previews, thumbnails, or image output for systems that don’t render PDFs.

Teams often use PDF-to-image conversion for:

- Web previews

- Thumbnail generation

- Image-based document workflows

## Convert PDF files to images with the Java SDK

Nutrient Java SDK provides PDF-to-image conversion through the `Document` API.

You don’t need to build:

- Custom PDF parsing logic

- External rendering pipelines

- Format-specific rasterization code

## Prepare the project

Define a package and class:

```java

package io.nutrient.Sample;

```

Import the required SDK classes:

```java

import io.nutrient.sdk.Document;
import io.nutrient.sdk.exceptions.NutrientException;

public class PDFToImage {

```

Create `main` and declare `NutrientException`:

```java

    public static void main(String[] args) throws NutrientException {

```

## Open the PDF document

Use `Document.open(...)` inside a [try-with-resources statement](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) so Java closes the document automatically:

```java

        try (Document document = Document.open("input_image_based.pdf")) {

```

## Export the PDF as an image

Call `exportAsImage(...)` to write image output:

```java

            document.exportAsImage("output.png");
        }
    }
}

```

Use a file path that’s absolute or relative to your working directory.

## Handle errors

Nutrient Java SDK raises `NutrientException` when an operation fails. You can declare it in the method signature, as shown above, or catch it with `try`/`catch` for custom handling.

## Summary

The conversion flow has two steps:

1. Open the PDF document.

2. Export it as an image.

Download [this sample package](https://www.nutrient.io/downloads/samples/java/pdf-to-image.zip) to run the example locally.
---

## Related pages

- [Converting HTML to PDF](/guides/java/conversion/html-to-pdf.md)
- [Converting CAD files to PDF](/guides/java/conversion/cad-to-pdf.md)
- [Converting PDF documents to Excel format for data analysis](/guides/java/conversion/pdf-to-excel-document.md)
- [Nutrient Java SDK conversion guides](/guides/java/conversion.md)
- [Converting a document from XLSX to PDF format](/guides/java/conversion/excel-document-to-pdf.md)
- [Converting email files to PDF](/guides/java/conversion/email-to-pdf.md)
- [Converting PDF documents to HTML format for web publishing](/guides/java/conversion/pdf-to-html.md)
- [Converting PDF documents to PDF/A format](/guides/java/conversion/pdf-to-pdf-a.md)
- [Converting a document from Markdown to PDF format](/guides/java/conversion/markdown-to-pdf.md)
- [Converting PDF documents to PDF/UA format](/guides/java/conversion/pdf-to-pdf-ua.md)
- [Converting PDF documents to Markdown format](/guides/java/conversion/pdf-to-markdown.md)
- [Converting a document from PPTX to PDF format](/guides/java/conversion/powerpoint-document-to-pdf.md)
- [Converting a document from PDF to DOCX format](/guides/java/conversion/pdf-to-word-document.md)
- [Converting a document from DOCX to PDF format](/guides/java/conversion/word-document-to-pdf.md)
- [Converting a document from DOCX to PDF/UA format](/guides/java/conversion/word-document-to-pdf-ua.md)
- [Converting PDF documents to PowerPoint presentations](/guides/java/conversion/pdf-to-powerpoint-document.md)
- [Converting a Word document to PDF while preserving comments](/guides/java/conversion/word-document-to-pdf-including-comments.md)

