---
title: "Android PDF to image library: Convert PDF to JPG, PNG | Nutrient"
canonical_url: "https://www.nutrient.io/guides/android/conversion/pdf-to-image/"
md_url: "https://www.nutrient.io/guides/android/conversion/pdf-to-image.md"
last_updated: "2026-05-15T19:10:04.904Z"
description: "Android PDF to image library: Convert PDF to JPG, PNG | guide for Nutrient Android SDK with detailed instructions and code examples."
---

# Convert PDFs to images on Android

To render an image from a PDF file in Nutrient Android SDK, you need to do the following:

### KOTLIN

```kotlin

try {
    // Create a Uri for the PDF file.
    val uri = Uri.parse("path/to/file.pdf")

    // Instantiate a `Document` from the PDF file's URL.
    val document =  PdfDocumentLoader.openDocument(context, uri)

    val pageIndex = 0
    val pageImageSize = document.getPageSize(pageIndex).toRect()

    // Create the image
    val bitmap = document.renderPageToBitmap(
        context,
        pageIndex
        pageImageSize.width().toInt()
        pageImageSize.height().toInt()
    )
} catch(ex: Exception) {
    // Handle error.
}

```

### JAVA

```java

try {
    // Create a Uri for the PDF file.
    final Uri uri = Uri.parse("path/to/file.pdf");

    // Instantiate a `Document` from the PDF file's URL.
    final PdfDocument document =  PdfDocumentLoader.openDocument(context, uri);

    final int pageIndex = 0;
    final RectF pageImageSize = document.getPageSize(pageIndex).toRect();

    //

    // Create the image.
    final Bitmap bitmap = document.renderPageToBitmap(
        context,
        pageIndex,
        (int)pageImageSize.width()
        (int)pageImageSize.height()
    );
} catch(final Exception exception) {
    // Handle error.
}

```

Note that the [`renderPageToBitmap`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/render-page-to-bitmap.html) API used in the above example is a synchronous API that will block whatever thread it’s called into, so make sure to either call it on a background thread or use the asynchronous method, [`renderPageToBitmapAsync`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/render-page-to-bitmap-async.html).
---

## Related pages

- [Effortlessly convert images to PDF on Android](/guides/android/conversion/image-to-pdf.md)
- [PDF conversion library for Android](/guides/android/conversion.md)
- [Converting HTML to PDFs on Android](/guides/android/generating-pdfs/generating-pdf-from-html.md)
- [Convert images to text on Android](/guides/android/conversion/image-to-text.md)
- [MS Office converter for Android](/guides/android/features/office-conversion.md)
- [Convert scanned documents to searchable PDFs on Android](/guides/android/conversion/scan-to-searchable-pdf.md)

