PdfTemplate constructor
Initializes a new instance of the PdfTemplate class.
//Create a new PDF template and draw graphical content like text, images, and more.
PdfDocument document = PdfDocument()
..pages.add().graphics.drawPdfTemplate(
PdfTemplate(100, 50)
..graphics!.drawString(
'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 14),
brush: PdfBrushes.black, bounds: Rect.fromLTWH(5, 5, 0, 0)),
Offset(0, 0));
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
PdfTemplate(double width, double height) {
_helper = PdfTemplateHelper(this);
_helper.content = PdfStream();
_setSize(width, height);
_helper.content[PdfDictionaryProperties.type] =
PdfName(PdfDictionaryProperties.xObject);
_helper.content[PdfDictionaryProperties.subtype] =
PdfName(PdfDictionaryProperties.form);
}