PDFConverter constructor

PDFConverter({
  1. required PDFPageFormat pageFormat,
  2. required Delta document,
  3. TextDirection textDirection = TextDirection.ltr,
  4. Delta? frontMatterDelta,
  5. Delta? backMatterDelta,
  6. List<CustomWidget> customBuilders = const <qpdf.CustomWidget>[],
  7. Future<Font> onRequestBoldFont(
    1. String
    )?,
  8. Future<Font> onRequestBoldItalicFont(
    1. String
    )?,
  9. Future<List<Font>?> onRequestFallbackFont(
    1. String
    )?,
  10. Future<Font> onRequestFont(
    1. String
    )?,
  11. Future<Font> onRequestItalicFont(
    1. String
    )?,
  12. required List<Font> fallbacks,
  13. double? blockQuotePaddingLeft,
  14. double? blockQuotePaddingRight,
  15. double? blockQuotethicknessDividerColor,
  16. PdfColor? blockQuoteBackgroundColor,
  17. PdfColor? blockQuoteDividerColor,
  18. TextStyle? blockQuoteTextStyle,
  19. PdfColor? codeBlockBackgroundColor,
  20. TextStyle? codeBlockNumLinesTextStyle,
  21. Font? codeBlockFont,
  22. TextStyle? codeBlockTextStyle,
  23. ThemeData? themeData,
  24. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectBlockquote,
  25. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectCodeBlock,
  26. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectAlignedParagraph,
  27. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectCommonText,
  28. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectHeaderBlock,
  29. PDFWidgetBuilder<Line, Widget>? onDetectImageBlock,
  30. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectInlineRichTextStyles,
  31. PDFWidgetBuilder<Line, List<InlineSpan>>? onDetectLink,
  32. PDFWidgetBuilder<List<InlineSpan>, Widget>? onDetectList,
})

Implementation

PDFConverter({
  required this.pageFormat,
  required this.document,
  this.textDirection = TextDirection.ltr,
  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(),
  ];
}