PDFConverter constructor

PDFConverter({
  1. required PDFPageFormat pageFormat,
  2. required Delta document,
  3. Delta? frontMatterDelta,
  4. Delta? backMatterDelta,
  5. List<CustomWidget> customBuilders = const <qpdf.CustomWidget>[],
  6. Future<Font> onRequestBoldFont(
    1. String
    )?,
  7. Future<Font> onRequestBoldItalicFont(
    1. String
    )?,
  8. Future<List<Font>?> onRequestFallbackFont(
    1. String
    )?,
  9. Future<Font> onRequestFont(
    1. String
    )?,
  10. 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. Font? codeBlockFont,
  21. TextStyle? codeBlockTextStyle,
  22. ThemeData? themeData,
  23. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectBlockquote,
  24. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectCodeBlock,
  25. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectAlignedParagraph,
  26. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectCommonText,
  27. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectHeaderBlock,
  28. PDFWidgetBuilder<Line, Widget>? onDetectImageBlock,
  29. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectInlineRichTextStyles,
  30. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectLink,
  31. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectList,
})

Implementation

PDFConverter({
  required this.pageFormat,
  required this.document,
  this.frontMatterDelta,
  this.backMatterDelta,
  this.customBuilders = const <qpdf.CustomWidget>[],
  this.onRequestBoldFont,
  this.onRequestBoldItalicFont,
  this.onRequestFallbackFont,
  this.onRequestFont,
  this.onRequestItalicFont,
  required List<pw.Font> fallbacks,
  this.blockQuotePaddingLeft,
  this.blockQuotePaddingRight,
  this.blockQuotethicknessDividerColor,
  this.blockQuoteBackgroundColor,
  this.blockQuoteDividerColor,
  this.blockQuoteTextStyle,
  this.codeBlockBackgroundColor,
  this.codeBlockNumLinesTextStyle,
  this.codeBlockFont,
  this.codeBlockTextStyle,
  this.themeData,
  this.onDetectBlockquote,
  this.onDetectCodeBlock,
  this.onDetectAlignedParagraph,
  this.onDetectCommonText,
  this.onDetectHeaderBlock,
  this.onDetectImageBlock,
  this.onDetectInlineRichTextStyles,
  this.onDetectLink,
  this.onDetectList,
})  : assert(pageFormat.height > 30, 'Page size height isn\'t valid'),
      assert(pageFormat.width > 30, 'Page size width isn\'t valid'),
      assert(pageFormat.marginBottom >= 0.0,
          'Margin to bottom with value ${pageFormat.marginBottom}'),
      assert(pageFormat.marginLeft >= 0.0,
          'Margin to left with value ${pageFormat.marginLeft}'),
      assert(pageFormat.marginRight >= 0.0,
          'Margin to right with value ${pageFormat.marginRight}'),
      assert(pageFormat.marginTop >= 0.0,
          'Margin to tp with value ${pageFormat.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(),
  ];
}