PdfOrderedList constructor

PdfOrderedList({
  1. PdfOrderedMarker? marker,
  2. PdfListItemCollection? items,
  3. String? text,
  4. PdfFont? font,
  5. PdfNumberStyle style = PdfNumberStyle.numeric,
  6. PdfStringFormat? format,
  7. bool markerHierarchy = false,
  8. double indent = 10,
  9. double textIndent = 5,
})

Initialize a new instance of the PdfOrderedList class.

//Create a new PDF document.
PdfDocument document = PdfDocument();
//Create a new ordered list.
PdfOrderedList(
    text: 'PDF\nXlsIO\nDocIO\nPPT',
    font: PdfStandardFont(PdfFontFamily.helvetica, 16,
        style: PdfFontStyle.italic),
    format: PdfStringFormat(lineSpacing: 20),
    marker: PdfOrderedMarker(style: PdfNumberStyle.numeric),
    style: PdfNumberStyle.numeric,
    indent: 15,
    textIndent: 10)
  ..draw(
      page: document.pages.add(), bounds: const Rect.fromLTWH(20, 20, 0, 0));
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfOrderedList(
    {PdfOrderedMarker? marker,
    PdfListItemCollection? items,
    String? text,
    PdfFont? font,
    PdfNumberStyle style = PdfNumberStyle.numeric,
    PdfStringFormat? format,
    this.markerHierarchy = false,
    double indent = 10,
    double textIndent = 5})
    : super() {
  final PdfListHelper helper = PdfListHelper(this);
  this.marker = marker ?? _createMarker(style);
  stringFormat = format;
  super.indent = indent;
  super.textIndent = textIndent;
  if (font != null) {
    helper.font = font;
  }
  if (items != null) {
    helper.items = items;
  } else if (text != null) {
    helper.items = PdfListHelper.createItems(text);
  }
}