Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Mar 23, 2021 4:37 am

Hi,

I want to use GraphikBold font while writing to a pdf but its not working; please suggest a way to do this. I have attached the font for your reference.

averghese
 
Posts: 6
Joined: Mon May 04, 2020 7:40 am

Tue Mar 23, 2021 7:33 am

Hello,

Thanks for your inquiry.
Do you want to embed private font to PDF document? If so, please refer to this tutorial: Embed private font to pdf document via Spire.PDF

Besides, I did not see the attachment you mentioned here. If there are still any issues, to help us investigate further, please provide your font file and your input file (if any). You could sent them to us([email protected]) via email. Thanks in advance.

sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Mar 23, 2021 10:29 am

Please find the font attached with this mail. I installed the font but while trying to embed it to my pdf its not working; I want to make it bold but its not working.

averghese
 
Posts: 6
Joined: Mon May 04, 2020 7:40 am

Tue Mar 23, 2021 12:26 pm

Code: Select all
PdfRGBColor rgb = new PdfRGBColor(184, 28, 42);
PdfSolidBrush solid = new PdfSolidBrush(rgb);
PdfTrueTypeFont trueTypeFontName = new PdfTrueTypeFont(new Font("GraphikBold", 10f, FontStyle.Bold), false);
document.Pages[0].Canvas.DrawString(name, trueTypeFontName, solid, 123, 68);


This is the code I used; no matter what I do its not printing bold.

averghese
 
Posts: 6
Joined: Mon May 04, 2020 7:40 am

Wed Mar 24, 2021 6:59 am

Hello,

Thanks for your sharing.
I tested your case and did reproduce your issue. I have logged it in our bug tracking system with the ticket SPIREPDF-4126. If there is any update, we will let you know. Apologize for the inconvenience caused.

Besides, I recommend you can try the following code to embed private fonts. I have verified the font can be successfully embedded in the PDF in this way.
Code: Select all
            PdfRGBColor rgb = new PdfRGBColor(184, 28, 42);
            PdfSolidBrush solid = new PdfSolidBrush(rgb);
            String fontFileName = @"GraphikBold.otf";//This is your font file path
            PdfTrueTypeFont trueTypeFontName = new PdfTrueTypeFont(fontFileName, 10f, PdfFontStyle.Bold);
            pdf.Pages[0].Canvas.DrawString("What a nice day!", trueTypeFontName, solid, 123, 68);


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Mar 25, 2021 7:09 am

Thank you so much for the response; its working for me now.

averghese
 
Posts: 6
Joined: Mon May 04, 2020 7:40 am

Thu Mar 25, 2021 7:39 am

You are welcome.
If there are any other questions related to our products, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF