Frequently Asked Question
Create Font object in VS
Last Updated 11 months ago
To create a font object, to be used to write text to the PDF, you need to do the following:
- Add the font file to the assets, and make sure to set the Advanced properties as:
- Add it to the font file list.
PDFGlobal.FontFileListStart(); PDFGlobal.FontFileListAdd(inst_path + "\\Assets\\font\\your font.ttf"); PDFGlobal.FontFileListEnd();
- Get the font face name, by enumerating all the fonts and search for the one you just added.
int face_first = 0; int face_count = PDFGlobal.GetFaceCount(); String fname = null; while (face_first < face_count) { fname = PDFGlobal.GetFaceName(face_first); face_first++; }
- Create the font object.
PDFDocFont dfont = pdfDoc.NewFontCID(fname, 8);
Note: A premium license is needed for this feature.