---
title: "Create PDFs from images on Android"
canonical_url: "https://www.nutrient.io/guides/android/pdf-generation/from-images/"
md_url: "https://www.nutrient.io/guides/android/pdf-generation/from-images.md"
last_updated: "2026-06-09T10:25:14.344Z"
description: "Learn how to convert images to PDFs on Android with PdfProcessor API using minimal code for fast PDF generation."
---

# Effortlessly generate PDFs from images on Android

Images are universal and can be used in various ways, such as showing relevant content or graphics. However, there might be an occasion where dealing with an image doesn’t suffice and you require a PDF instead. Using the versatile [`PdfProcessor`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor/index.html) API enables you to convert a bitmap into a PDF file with minimal code.

First, create a [`PageImage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-page-image/index.html) object — it contains which image should be used and how it should be compressed. Then, create a [`NewPage`], which contains the information specifying how large the page should be and that it should include the previously created [`PageImage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-page-image/index.html).

Next, use a [`PdfProcessorTask`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor-task/index.html) and add the [`NewPage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-new-page/index.html) instance as the first page. Finally, [`PdfProcessor`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor/index.html) generates the actual PDF and writes it to the disk to the specified `outputFile`:

### KOTLIN

```kotlin

val image: Bitmap =...
val outputFile: File =...
val imageSize = Size(image.width.toFloat(), image.height.toFloat())
val pageImage = PageImage(image, PagePosition.CENTER)
pageImage.setJpegQuality(70)
val newPage = NewPage.emptyPage(imageSize).withPageItem(pageImage).build()

val task = PdfProcessorTask.newPage(newPage)
val disposable = PdfProcessor.processDocumentAsync(task, outputFile).subscribe { progress ->  }

```

### JAVA

```java

final Bitmap image =...
final File outputFile =...
final Size imageSize = new Size(image.getWidth(), image.getHeight());
final PageImage pageImage = new PageImage(image, PagePosition.CENTER);
pageImage.setJpegQuality(70);
final NewPage newPage = NewPage.emptyPage(imageSize).withPageItem(pageImage).build();

final PdfProcessorTask task = PdfProcessorTask.newPage(newPage);
final Disposable disposable = PdfProcessor.processDocumentAsync(task, outputFile).subscribe(progress -> { });

```

## Generating a PDF with multiple images

To generate a PDF file with multiple images, you can create multiple [`PageImage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-page-image/index.html) and [`NewPage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-new-page/index.html) pairs, each with its own image. Then, use the `addNewPage` method of [`PdfProcessorTask`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor-task/index.html) to add the extra pages, like so:

### KOTLIN

```kotlin

val task = PdfProcessorTask.newPage(firstPage).addNewPage(secondPage, 1).addNewPage(thirdPage, 2).addNewPage(fourthPage, 3);

```

### JAVA

```java

final PdfProcessorTask task = PdfProcessorTask.newPage(firstPage).addNewPage(secondPage, 1).addNewPage(thirdPage, 2).addNewPage(fourthPage, 3);

```
---

## Related pages

- [Generate blank PDFs on Android](/guides/android/features/document-creation.md)
- [PDF generation library for Android](/guides/android/pdf-generation.md)
- [Generate PDFs from HTML on Android](/guides/android/pdf-generation/from-html.md)
- [Generate PDF reports on Android](/guides/android/generating-pdfs/generating-pdf-reports.md)
- [Generate PDFs programmatically on Android](/guides/android/pdf-generation/programmatically.md)
- [Effortlessly generate PDF thumbnails on Android](/guides/android/pdf-generation/thumbnail-preview.md)
- [Generate PDFs from a template on Android](/guides/android/pdf-generation/from-template.md)

