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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PdfTrueTypeFont not working

Thread ID:

Created:

Updated:

Platform:

Replies:

117213 Sep 8,2014 02:39 AM UTC Sep 10,2014 05:32 AM UTC WinRT 3
loading
Tags: PDF
Nick Randolph
Asked On September 8, 2014 02:39 AM UTC

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 04:23 AM UTC

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,

Praveen


Nick Randolph
Replied On September 9, 2014 04:35 AM UTC

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

Thanks


Attachment: StagMedium_95d8774.zip

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

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.

Regards,
George

CONFIRMATION

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.

Warning Icon 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.Close Icon

;