Scale or resize PDFs on Android

Nutrient Android SDK’s PdfProcessor combined with a PdfProcessorTask can be used to scale pages of a document:

val task = PdfProcessorTask.fromDocument(document)
// Scale the first page down to half its size.
val pageSize = document.getPageSize(0)
val halfSize = Size(pageSize.width / 2, pageSize.height / 2)
task.resizePage(0, halfSize)
// Output to a new document.
val outputFile = File(context.filesDir, "outputDocument.pdf")
PdfProcessor.processDocument(task, outputFile)
final PdfProcessorTask task = PdfProcessorTask.fromDocument(document);
// Scale the first page down to half its size.
final Size pageSize = document.getPageSize(0);
final Size halfSize = new Size(pageSize.width / 2, pageSize.height / 2);
task.resizePage(0, halfSize)
// Output to a new document.
final File outputFile = new File(context.getFilesDir(), "outputDocument.pdf");
PdfProcessor.processDocument(task, outputFile);

To learn more about how to define the page size with PDF points, consult our coordinate space conversions guide.

Information

Resizing pages with the PdfProcessor is only available if you have the Document Editor enabled in your license.