PDFConverter class

Constructors

PDFConverter({required PDFPageFormat pageFormat, required Delta document, TextDirection textDirection = TextDirection.ltr, Delta? frontMatterDelta, Delta? backMatterDelta, List<CustomWidget> customBuilders = const <qpdf.CustomWidget>[], Future<Font> onRequestBoldFont(String)?, Future<Font> onRequestBoldItalicFont(String)?, Future<List<Font>?> onRequestFallbackFont(String)?, Future<Font> onRequestFont(String)?, Future<Font> onRequestItalicFont(String)?, required List<Font> fallbacks, double? blockQuotePaddingLeft, double? blockQuotePaddingRight, double? blockQuotethicknessDividerColor, PdfColor? blockQuoteBackgroundColor, PdfColor? blockQuoteDividerColor, TextStyle? blockQuoteTextStyle, PdfColor? codeBlockBackgroundColor, TextStyle? codeBlockNumLinesTextStyle, Font? codeBlockFont, TextStyle? codeBlockTextStyle, ThemeData? themeData, PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectBlockquote, PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectCodeBlock, PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectAlignedParagraph, PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectCommonText, PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectHeaderBlock, PDFWidgetBuilder<Line, Widget>? onDetectImageBlock, PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectInlineRichTextStyles, PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectLink, PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectList})

Properties

backMatterDelta → Delta?
This delta is used after the main content
final
blockQuoteBackgroundColor → PdfColor?
Customize the background of the blockquote
final
blockQuoteDividerColor → PdfColor?
Customize the left/right divider color to blockquotes
final
blockQuotePaddingLeft double?
Define the left space between divider and text
final
blockQuotePaddingRight double?
final
blockQuoteTextStyle → TextStyle?
Define the text style of the general blockquote. This overrides any style detected like: line-height, size, font families, color
final
blockQuotethicknessDividerColor double?
Define the width of the divider
final
codeBlockBackgroundColor → PdfColor?
Customize the background color of the code block
final
codeBlockFont → Font?
If you need just a different font to show your code blocks, use this font (by default is pw.Font.courier())
final
codeBlockNumLinesTextStyle → TextStyle?
Customize the style of the num lines in code block
final
codeBlockTextStyle → TextStyle?
If you need customize exactly how the code block looks, then you use this theme
final
customBuilders List<CustomWidget>
CustomPDFWidget allow devs to use builders to create custom widgets
final
document → Delta
final
frontMatterDelta → Delta?
This delta is used before the main content
final
globalFontsFallbacks List<Font>
latefinal
hashCode int
The hash code for this object.
no setterinherited
onDetectAlignedParagraph PDFWidgetBuilder<List<InlineSpan>, Widget>?
When a aligned block is detected, this builder is called
final
onDetectBlockquote PDFWidgetBuilder<List<InlineSpan>, Widget>?
When a block quote is detected, this builder is called
final
onDetectCodeBlock PDFWidgetBuilder<List<InlineSpan>, Widget>?
When a code block is detected, this builder is called
final
onDetectCommonText PDFWidgetBuilder<Line, List<InlineSpan>>?
When a non rich text line is detected, this builder is called Tipically this happens when the insertion has not inline attributes
final
onDetectHeaderBlock PDFWidgetBuilder<List<InlineSpan>, Widget>?
When a header block is detected, this builder is called
final
onDetectImageBlock PDFWidgetBuilder<Line, Widget>?
final
onDetectInlineRichTextStyles PDFWidgetBuilder<Line, List<InlineSpan>>?
When a rich text styles are detected, this builder is called
final
When a link line is detected, this builder is called
final
onDetectList PDFWidgetBuilder<List<InlineSpan>, Widget>?
When a list block is detected, this builder is called
final
onRequestBoldFont Future<Font> Function(String)?
A simple request font when converter detect a font
final
onRequestBoldItalicFont Future<Font> Function(String)?
A simple request font when converter detect a font
final
onRequestFallbackFont Future<List<Font>?> Function(String)?
final
onRequestFont Future<Font> Function(String)?
A simple request font when converter detect a font
final
onRequestItalicFont Future<Font> Function(String)?
A simple request font when converter detect a font
final
pageFormat PDFPageFormat
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textDirection TextDirection
This will set the default direction for all the document or the common widgets if them doesn't have direction attribute
final
themeData → ThemeData?
If you need to customize the theme of the pdf document, override this param
final

Methods

createDocument({DeltaAttributesOptions? deltaOptionalAttr, bool overrideAttributesPassedByUser = false, void onException(dynamic error)?, bool shouldProcessDeltas = true}) Future<Document?>
Creates the PDF document an return this one
createDocumentFile({required String path, void onException(dynamic error)?, void onSucessWrite([Object? data])?, DeltaAttributesOptions? deltaOptionalAttr, bool overrideAttributesPassedByUser = false, bool shouldProcessDeltas = true, bool isWeb = false}) Future<void>
This Create the PDF document and write it to storage path This implementation can throw PathNotFoundException or exceptions based in Storage capabilities
generateWidget({DeltaAttributesOptions? deltaOptionalAttr, double? maxWidth, double? maxHeight, bool overrideAttributesPassedByUser = false, void onException(dynamic error)?, bool shouldProcessDeltas = true}) Future<Widget?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

processDelta(Delta? delta, DeltaAttributesOptions options, bool overrideAttributesPassedByUser) → Delta?