Generate a blank PDF in Flutter
Nutrient enables you to create blank PDF documents from scratch with PspdfkitProcessor
(opens in a new tab).
The following example creates a new single-page blank PDF document from a NewPage
object(opens in a new tab). 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
(opens in a new tab) documentation and the PDF Generation Example(opens in a new tab) from the Catalog app(opens in a new tab).