PDFConverter constructor
PDFConverter({
- required PDFPageFormat params,
- required Delta document,
- required Delta? frontMatterDelta,
- required Delta? backMatterDelta,
- required List<
CustomConverter> customConverters, - required Future<
Font> onRequestBoldFont(), - required Future<
Font> onRequestBoldItalicFont(), - required Future<
List< onRequestFallbackFont()?,Font> ?> - required Future<
Font> onRequestFont(), - required Future<
Font> onRequestItalicFont(), - required List<
Font> fallbacks, - double? blockQuotePaddingLeft,
- double? blockQuotePaddingRight,
- double? blockQuotethicknessDividerColor,
- PdfColor? blockQuoteBackgroundColor,
- PdfColor? blockQuoteDividerColor,
- TextStyle? blockQuoteTextStyle,
- PdfColor? codeBlockBackgroundColor,
- TextStyle? codeBlockNumLinesTextStyle,
- List<
Rule> ? customRules, - Font? codeBlockFont,
- TextStyle? codeBlockTextStyle,
- ThemeData? themeData,
- String customDeltaToHTMLConverter(
- Delta
- String customHTMLToMarkdownConverter()?,
- CustomPDFWidget? onDetectBlockquote,
- CustomPDFWidget? onDetectCodeBlock,
- CustomPDFWidget? onDetectAlignedParagraph,
- CustomPDFWidget? onDetectCommonText,
- CustomPDFWidget? onDetectHeaderAlignedBlock,
- CustomPDFWidget? onDetectHeaderBlock,
- CustomPDFWidget? onDetectImageBlock,
- CustomPDFWidget? onDetectInlineRichTextStyles,
- CustomPDFWidget? onDetectInlinesMarkdown,
- CustomPDFWidget? onDetectLink,
- CustomPDFWidget? onDetectList,
- ConverterOptions? convertOptions,
Implementation
PDFConverter({
required this.params,
required this.document,
required this.frontMatterDelta,
required this.backMatterDelta,
required this.customConverters,
required this.onRequestBoldFont,
required this.onRequestBoldItalicFont,
required this.onRequestFallbackFont,
required this.onRequestFont,
required this.onRequestItalicFont,
required List<pw.Font> fallbacks,
this.blockQuotePaddingLeft,
this.blockQuotePaddingRight,
this.blockQuotethicknessDividerColor,
this.blockQuoteBackgroundColor,
this.blockQuoteDividerColor,
this.blockQuoteTextStyle,
this.codeBlockBackgroundColor,
this.codeBlockNumLinesTextStyle,
this.customRules,
this.codeBlockFont,
this.codeBlockTextStyle,
this.themeData,
this.customDeltaToHTMLConverter,
this.customHTMLToMarkdownConverter,
this.onDetectBlockquote,
this.onDetectCodeBlock,
this.onDetectAlignedParagraph,
this.onDetectCommonText,
this.onDetectHeaderAlignedBlock,
this.onDetectHeaderBlock,
this.onDetectImageBlock,
this.onDetectInlineRichTextStyles,
this.onDetectInlinesMarkdown,
this.onDetectLink,
this.onDetectList,
this.convertOptions,
}) : assert(params.height > 30, 'Page size height isn\'t valid'),
assert(params.width > 30, 'Page size width isn\'t valid'),
assert(params.marginBottom >= 0.0,
'Margin to bottom with value ${params.marginBottom}'),
assert(params.marginLeft >= 0.0,
'Margin to left with value ${params.marginLeft}'),
assert(params.marginRight >= 0.0,
'Margin to right with value ${params.marginRight}'),
assert(params.marginTop >= 0.0,
'Margin to tp with value ${params.marginTop}') {
globalFontsFallbacks = <pw.Font>[
...fallbacks,
pw.Font.helvetica(),
pw.Font.helveticaBold(),
pw.Font.helveticaOblique(),
pw.Font.symbol(),
pw.Font.times(),
pw.Font.timesBold(),
pw.Font.timesItalic(),
pw.Font.timesBoldItalic(),
pw.Font.courier(),
pw.Font.courierBold(),
pw.Font.courierOblique(),
pw.Font.courierBoldOblique(),
];
}