Generate a blank PDF in Flutter

Nutrient enables you to create blank PDF documents from scratch with PspdfkitProcessor.

The following example creates a new single-page blank PDF document from a NewPage object. This can define the size of the page, colors, patterns, images, and pages of other documents. After processing, the outputPath will contain the new blank document:

// Location where to save the generated PDF.
String outputPath = '<writable-output-path>';

List<NewPage> pages = [
    // `NewPage` from blank PDF pattern.
    NewPage.fromPattern(
        PagePattern.blank, pageSize: PageSize.a5),
];

// Generate blank PDF document.
var filePath = await PspdfkitProcessor.instance.generatePdf(pages, outputPath);

For more information on generating PDF files from HTML strings and URLs, see the PspdfkitProcessor documentation and the PDF Generation Example from the Catalog app.