build method

  1. @protected
  2. @mustCallSuper
void build(
  1. PdfPage page,
  2. PdfObject<PdfDataType> object,
  3. PdfDict<PdfDataType> params
)

Implementation

@protected
@mustCallSuper
void build(PdfPage page, PdfObject object, PdfDict params) {
  params['/Subtype'] = PdfName(subtype);
  params['/Rect'] =
      PdfArray.fromNum([rect.left, rect.bottom, rect.right, rect.top]);

  params['/P'] = page.ref();

  // handle the border
  if (border == null) {
    params['/Border'] = PdfArray.fromNum(const [0, 0, 0]);
  } else {
    params['/BS'] = border!.ref();
  }

  if (content != null) {
    params['/Contents'] = PdfString.fromString(content!);
  }

  if (name != null) {
    params['/NM'] = PdfString.fromString(name!);
  }

  if (flags != null && flags!.isNotEmpty) {
    params['/F'] = PdfNum(flagValue);
  }

  if (date != null) {
    params['/M'] = PdfString.fromDate(date!);
  }

  if (color != null) {
    params['/C'] = PdfArray.fromColor(color!);
  }

  if (subject != null) {
    params['/Subj'] = PdfString.fromString(subject!);
  }

  if (author != null) {
    params['/T'] = PdfString.fromString(author!);
  }

  if (_appearances.isNotEmpty) {
    params['/AP'] = PdfDict.values(_appearances);
    if (_as != null) {
      params['/AS'] = _as!;
    }
  }
}