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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Font wont display in PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

116555 Jun 9,2014 01:07 PM UTC Jun 12,2014 02:37 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: PDF
Tej Sidhu
Asked On June 9, 2014 01:07 PM UTC

Hi,

I have a custom font.  The font's embeddability is set to Preview/Print.  I've tested the font is able to render in PDF by converting a word document using the font into a PDF.

I've tried various ways to embed this font but have failed to get it working:

    Private Function CreatePdfFont(ByVal FontSize As IntegerByVal FontStyle As Drawing.FontStyleAs PdfFont
        Const fontFilePath As String = "c:\\Windows\\Fonts\\Duke-Fill.ttf"
C:\Windows\Fonts        Dim fnt = New Font(fontFilePath, FontSize, FontStyle)
        Dim objTrueTypeFont = New PdfTrueTypeFont(fnt, False)
        Dim objTTFont As PdfFont = objTrueTypeFont
        Return objTTFont
 
    End Function

and

Private Function CreatePdfFont(ByVal FontSize As IntegerByVal FontStyle As Drawing.FontStyleAs PdfFont
        Dim FontName "Duke Fill"
        Dim objFont As New Font(FontName, FontSize, FontStyle)
        Dim objTrueTypeFont = New PdfTrueTypeFont(objFont, False)
        Dim objTTFont As PdfFont = objTrueTypeFont
        Return objTTFont
 
    End Function

I've tried various ways.  I've played around with the fontName and the path but nothing seems to work.

To help diagnose this I've attached screenshots of the properties for the file and the font itself.

Any help you can give will be much appreciated.


Attachment: Untitled1_8de7dec.zip

KarthikeyanC [Syncfusion]
Replied On June 12, 2014 02:37 PM UTC

Hi Tej,

Thank you for using Syncfusion Products.

Please use the below code to use custom font in PDF document.

Code snippet:

    Private Function CreatePdfFont(ByVal FontSize As Integer, ByVal FontStyle As Drawing.FontStyle) As PdfFont

        Const fontFilePath As String = "c:\\Windows\\Fonts\\Duke-Fill.ttf"

        Dim objTrueTypeFont = New PdfTrueTypeFont(fontFilePath, 18f)

        Dim objTTFont As PdfFont = objTrueTypeFont

        Return objTTFont

 

    End Function

Please let us know if you have any concern.

Thanks,

Karthikeyan.C


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

;