PdfStringFormat constructor

PdfStringFormat({
  1. PdfTextAlignment alignment = PdfTextAlignment.left,
  2. PdfVerticalAlignment lineAlignment = PdfVerticalAlignment.top,
  3. PdfTextDirection textDirection = PdfTextDirection.none,
  4. double characterSpacing = 0,
  5. double wordSpacing = 0,
  6. double lineSpacing = 0,
  7. PdfSubSuperscript subSuperscript = PdfSubSuperscript.none,
  8. double paragraphIndent = 0,
  9. bool measureTrailingSpaces = false,
  10. PdfWordWrapType wordWrap = PdfWordWrapType.word,
})

Initializes a new instance of the PdfStringFormat class with horizontal alignment and vertical alignment of text.

//Create a new PDF document.
PdfDocument document = PdfDocument()
  ..pages.add().graphics.drawString(
      'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 12),
      //Create a new PDF string format instance.
      format: PdfStringFormat(
          alignment: PdfTextAlignment.left,
          lineAlignment: PdfVerticalAlignment.top,
          textDirection: PdfTextDirection.leftToRight,
          characterSpacing: 0.5,
          wordSpacing: 0.5,
          lineSpacing: 0.5,
          subSuperscript: PdfSubSuperscript.superscript,
          paragraphIndent: 10,
          measureTrailingSpaces: true,
          wordWrap: PdfWordWrapType.word));
//Save the document.
List<int> bytes = await document.save();
//Close the document.
document.dispose();

Implementation

PdfStringFormat(
    {PdfTextAlignment alignment = PdfTextAlignment.left,
    PdfVerticalAlignment lineAlignment = PdfVerticalAlignment.top,
    PdfTextDirection textDirection = PdfTextDirection.none,
    double characterSpacing = 0,
    double wordSpacing = 0,
    double lineSpacing = 0,
    PdfSubSuperscript subSuperscript = PdfSubSuperscript.none,
    double paragraphIndent = 0,
    bool measureTrailingSpaces = false,
    PdfWordWrapType wordWrap = PdfWordWrapType.word}) {
  _helper = PdfStringFormatHelper();
  _initialize(
      alignment,
      lineAlignment,
      textDirection,
      characterSpacing,
      wordSpacing,
      lineSpacing,
      subSuperscript,
      paragraphIndent,
      measureTrailingSpaces,
      wordWrap);
}