PdfService constructor
PdfService({
- required PDFPageFormat pageFormat,
- required List<
Font> fonts, - TextDirection textDirection = pw.TextDirection.ltr,
- Future<
Font> onRequestBoldFont(- String fontFamily
- Future<
Font> onRequestBothFont(- String fontFamily
- Future<
List< onRequestFallbacks(Font> ?>- String fontFamily
- Future<
Font> onRequestFont(- String fontFamily
- Future<
Font> onRequestItalicFont(- String fontFamily
- required List<
CustomWidget> customBuilders, - required Delta document,
- ThemeData? customTheme,
- Font? codeBlockFont,
- PdfColor? blockQuoteBackgroundColor,
- PdfColor? codeBlockBackgroundColor,
- TextStyle? codeBlockNumLinesTextStyle,
- TextStyle? codeBlockTextStyle,
- PdfColor? blockQuoteDividerColor,
- TextStyle? blockQuoteTextStyle,
- double? blockQuotePaddingLeft,
- double? blockQuotePaddingRight,
- double? blockQuotethicknessDividerColor,
- PDFWidgetBuilder<
List< ? onDetectBlockquote,InlineSpan> , Widget> - PDFWidgetBuilder<
List< ? onDetectCodeBlock,InlineSpan> , Widget> - PDFWidgetBuilder<
List< ? onDetectAlignedParagraph,InlineSpan> , Widget> - PDFWidgetBuilder<
Line, List< ? onDetectCommonText,InlineSpan> > - PDFWidgetBuilder<
List< ? onDetectHeaderBlock,InlineSpan> , Widget> - PDFWidgetBuilder<
Line, Widget> ? onDetectImageBlock, - PDFWidgetBuilder<
Line, List< ? onDetectInlineRichTextStyles,InlineSpan> > - PDFWidgetBuilder<
Line, List< ? onDetectLink,InlineSpan> > - PDFWidgetBuilder<
List< ? onDetectList,InlineSpan> , Widget> - Delta? backM,
- Delta? frontM,
Implementation
PdfService({
required PDFPageFormat pageFormat,
required List<pw.Font> fonts,
this.textDirection = pw.TextDirection.ltr,
super.onRequestBoldFont,
super.onRequestBothFont,
super.onRequestFallbacks,
super.onRequestFont,
super.onRequestItalicFont,
required super.customBuilders,
required super.document,
pw.ThemeData? customTheme,
super.codeBlockFont,
super.blockQuoteBackgroundColor,
super.codeBlockBackgroundColor,
super.codeBlockNumLinesTextStyle,
super.codeBlockTextStyle,
super.blockQuoteDividerColor,
super.blockQuoteTextStyle,
super.blockQuotePaddingLeft,
super.blockQuotePaddingRight,
super.blockQuotethicknessDividerColor,
super.onDetectBlockquote,
super.onDetectCodeBlock,
super.onDetectAlignedParagraph,
super.onDetectCommonText,
super.onDetectHeaderBlock,
super.onDetectImageBlock,
super.onDetectInlineRichTextStyles,
super.onDetectLink,
super.onDetectList,
super.backM,
super.frontM,
}) {
_fonts = fonts;
defaultTextStyle = pw.TextStyle(
fontSize: defaultFontSize.toDouble(),
lineSpacing: 1.0,
fontFallback: <pw.Font>[..._fonts],
);
_marginLeft = pageFormat.marginLeft;
_marginBottom = pageFormat.marginBottom;
_marginTop = pageFormat.marginTop;
_marginRight = pageFormat.marginRight;
_width = pageFormat.width;
_height = pageFormat.height;
pageWidth = pageFormat.width;
pageHeight = pageFormat.height;
defaultTheme = customTheme ??
pw.ThemeData(
softWrap: true,
textAlign: pw.TextAlign.left,
iconTheme: pw.IconThemeData.fallback(pw.Font.symbol()),
overflow: pw.TextOverflow.span,
defaultTextStyle: pw.TextStyle(
color: PdfColors.black,
fontWeight: pw.FontWeight.normal,
fontStyle: pw.FontStyle.normal,
letterSpacing: 0,
wordSpacing: 1.0,
lineSpacing: 1.0,
height: 1,
decoration: pw.TextDecoration.none,
decorationColor: null,
decorationStyle: pw.TextDecorationStyle.solid,
decorationThickness: 1,
renderingMode: PdfTextRenderingMode.fill,
fontFallback: <pw.Font>[..._fonts],
),
);
}