How to select a specific system font when adding new PDF content?

How to select a specific system font when adding new PDF content?

I am using the new ‘pdftron.PDF.Font.Create(doc, “font name”)’ that was added in recent PDFNet versions and would like to add a PDF based on a system font (e.g. Helvetica Neuve on Mac).

I was able to find the HelveticaNeuve.dfont in my machine, copy it to the project and this line works
Font font = Font.createTrueTypeFont(doc, (input_path + “HelveticaNeue.dfont”));

but can I do something like pdftron.PDF.Font.Create(doc, “HelveticaNeue”)?


We have a question about the font selection on Mac. The pdftron::PDF::Font::CreateCIDTrueTypeFont function accepts font path. How can we specify font style (bold, italic…) if the file contains more of them (typically ttc and dfont)? We found this post and tried to change Font Descriptor (Flags and FontWeight) but it had no effect. As a solution we can query font tables and build a temporary ttf file. Is there any simpler way?


Changing for descriptor won’t help because the font is already selected/created.

Unfortunately CreateCIDTrueTypeFont() that accepts a path currently selects the first font from TTC file. You could use pdftron.PDF.Font.Create(doc, “Times Bold”) to select font by its name (that can include style properties such as “Bold“, “Italic” etc).

Fortunately code to extract a TTF from TTC is fairly simple (if you are PDFNet licensee you can contact support to get a copy) so you can extract the required TTF then pass it to CreateCIDTrueTypeFont()).