Skip to main content

Creating PDF Documents | Flutter Document Scanner

PDF Creation

ScanbotSdk.createPdf(pages, options)

The Scanbot SDK renders given page images into a multi-page PDF document and stores it as a file. For each DOCUMENT image a separate page is generated.

List<Page> pages = ...
var options = PdfRenderingOptions(pageSize: PageSize.A4);
Uri pdfFileUri = await ScanbotSdk.createPdf(pages, options);
Arguments:
  • pages - a list of valid Page objects. Each page should have the cropped DOCUMENT image.
  • options - PdfRenderingOptions(PdfRenderSize renderPageSize)
    • [pageSize] enum value to specify the output page size.
    • [pageDirection] page orientation eg portrait, landscape or automatic.
    • [pdfAttributes] attributes of pdf file. Author, title, etc.
class PdfRenderingOptions {
/// The direction of the page in the PDF document.
final PageDirection pageDirection;

/// The size of the page in the PDF document.
final PageSize pageSize;

/// The PDF document attributes.
final PdfAttributes pdfAttributes;
}


/// The page size of the pdf document.
enum PageSize {
/// Letter page size. */
LETTER,

/// Legal page size. */
LEGAL,

/// A3 page size. */
A3,

/// A4 page size. */
A4,

/// A5 page size. */
A5,

/// B4 page size. */
B4,

/// B5 page size. */
B5,

/// Executive page size. */
EXECUTIVE,

/// US4x6 page size. */
US4x6,

/// US4x8 page size. */
US4x8,

/// US5x7 page size. */
US5x7,

/// COMM10 page size. */
COMM10,

/// Custom page size. From the Image. */
CUSTOM,
}


/// The PDF file attributes.
class PdfAttributes {
/// The creator of the PDF document.
final String creator;

/// The author of the PDF document.
final String author;

/// The title of the PDF document.
final String title;

/// The subject of the PDF document.
final String subject;

/// The keywords of the PDF document.
final String keywords;

}

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top