PDFConverter constructor

PDFConverter({
  1. required PDFPageFormat params,
  2. required Delta document,
  3. required Delta? frontMatterDelta,
  4. required Delta? backMatterDelta,
  5. required List<CustomConverter> customConverters,
  6. required Future<Font> onRequestBoldFont(
    1. String
    ),
  7. required Future<Font> onRequestBoldItalicFont(
    1. String
    ),
  8. required Future<List<Font>?> onRequestFallbackFont(
    1. String
    )?,
  9. required Future<Font> onRequestFont(
    1. String
    ),
  10. required Future<Font> onRequestItalicFont(
    1. String
    ),
  11. required List<Font> fallbacks,
  12. double? blockQuotePaddingLeft,
  13. double? blockQuotePaddingRight,
  14. double? blockQuotethicknessDividerColor,
  15. PdfColor? blockQuoteBackgroundColor,
  16. PdfColor? blockQuoteDividerColor,
  17. TextStyle? blockQuoteTextStyle,
  18. PdfColor? codeBlockBackgroundColor,
  19. TextStyle? codeBlockNumLinesTextStyle,
  20. List<Rule>? customRules,
  21. Font? codeBlockFont,
  22. TextStyle? codeBlockTextStyle,
  23. ThemeData? themeData,
  24. String customDeltaToHTMLConverter(
    1. Delta
    )?,
  25. String customHTMLToMarkdownConverter(
    1. String
    )?,
  26. CustomPDFWidget? onDetectBlockquote,
  27. CustomPDFWidget? onDetectCodeBlock,
  28. CustomPDFWidget? onDetectAlignedParagraph,
  29. CustomPDFWidget? onDetectCommonText,
  30. CustomPDFWidget? onDetectHeaderAlignedBlock,
  31. CustomPDFWidget? onDetectHeaderBlock,
  32. CustomPDFWidget? onDetectImageBlock,
  33. CustomPDFWidget? onDetectInlineRichTextStyles,
  34. CustomPDFWidget? onDetectInlinesMarkdown,
  35. CustomPDFWidget? onDetectLink,
  36. CustomPDFWidget? onDetectList,
  37. 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(),
  ];
}