I m trying to insert text inside a PDFPage but I m failed to load a PDFDocFont.
In fact, I added the font at the initialization on the AppOnLaunched() Method this way:
PDFGlobal.FontFileListAdd(inst_path + "\\Assets\\font\\argbsn00lp.ttf");
And when I m trying to get it this way :
PDFDocFont dfont = pdfDoc.NewFontCID("argbsn00lp.ttf", ;
But unfortunately, I m always getting a null dfon, I tried to change the style from 8 to 1 but with no success.
Any help please ?
NewFontCID expects the font name (not the font file name), font name exists in the font list.
To get the font name you should use PDFGlobal.GetFaceCount(), PDFGlobal.GetFaceName() to enumerate fonts (after PDFGlobal.FontFileListEnd()), and use the font name related to your file.
int face_first = 0;
int face_count = PDFGlobal.GetFaceCount();
String fname = null;
while (face_first < face_count)
fname = PDFGlobal.GetFaceName(face_first);
Make sure to call this after activating the premium license.
Make sure that the font file has Build Action = Content and Copy to Output Directory = Copy if Newer
In fact, my PDFGlobal.GetFaceCount() returns 3 with 3 names but when I call NewFontCID with one of the three I m always getting a null.
I m using it the same way as the preview project with a premium licence and I changed the font file properties to
Build Action - Content
Copy to Output Directory = Copy if Newer
But I m always getting a null as shown in the watch screenShot.