PdfTrueTypeFont constructor
PdfTrueTypeFont(
- List<
int> fontData, - double size, {
- PdfFontStyle? style,
- List<
PdfFontStyle> ? multiStyle,
Initializes a new instance of the PdfTrueTypeFont class.
fontData represents the font sream formated as list of bytes. size represents the font size to draw the text. style and multistyle are used to set font styles.
//Create a new PDF document.
PdfDocument document = PdfDocument();
//Create a new PDF true type font instance and draw string to PDF page.
document.pages.add().graphics.drawString(
'Hello World!',
PdfTrueTypeFont(fontStream, 12),
brush: PdfBrushes.black,
bounds: Rect.fromLTWH(0, 0, 100, 50));
//Saves the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
PdfTrueTypeFont(List<int> fontData, double size,
{PdfFontStyle? style, List<PdfFontStyle>? multiStyle}) {
_helper = PdfTrueTypeFontHelper(this);
_initializeFont(fontData, size, style, multiStyle);
}