We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PdfTrueTypeFont not working

Thread ID:





117213 Sep 7,2014 10:39 PM Sep 10,2014 01:32 AM WinRT 3
Tags: PDF
Nick Randolph
Asked On September 7, 2014 10:39 PM

Hi - we have a number a .ttf font files that are part of our project that we need to use, the client requirement is the fonts cannot be installed on the machine so we need to load them from the project folder. I've attempted to do this without success, in the instance below the font remains on the default and doesn't change to use our .ttf. Can you take a look at our code and let us know what the issue is, thanks.

var installationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assetFolder = await installationFolder.GetFolderAsync("Assets");
var fontFolder = await assetFolder.GetFolderAsync("Fonts");
var stagMediumFontFile = await fontFolder.GetFileAsync(Constants.StagSansMediumPath);
var stagMediumFontFileStream = await stagMediumFontFile.OpenStreamForReadAsync();

PdfTextElement element = new PdfTextElement("Test Text);
var stagMediumFont = new PdfTrueTypeFont(stagMediumFontFileStream, 70);
element.Font = stagMediumFont;
element.Brush = new PdfSolidBrush(new PdfColor(32, 2, 78));
PdfLayoutResult result = element.Draw(page, new RectangleF(115, 260, page.Graphics.ClientSize.Width / 2, 200));

As you can see above, we are just getting a stream of the font file from the installation directory, then using that stream to create a PdfTrueTypeFont .. when I inspect the stagMediumFont variable it seems as the the font has been read correctly as the name and properties appear, but when the text is drawn on the screen it is not using the specified font.

Praveenkumar H [Syncfusion]
Replied On September 9, 2014 12:23 AM

Hi Nick,

Thank you for using syncfusion products,

Could you please send us the font file, it will help us to investigate further in this.

With Regards,


Nick Randolph
Replied On September 9, 2014 12:35 AM

Praveen, here's the font file that's causing us issues.


Attachment: StagMedium_95d8774.zip

George Livingston [Syncfusion]
Replied On September 10, 2014 01:32 AM

Hi Nick,

Thank you for you reply.

We could see that same query followed up in the incident 129376. Please follow up in the incident for the solution.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.