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. Image for the cookie policy date
close icon

Font wont display in PDF

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

1 Reply

KC Karthikeyan Chandrasekar Syncfusion Team 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


Loader.
Live Chat Icon For mobile
Up arrow icon