Text Not showing for an embedded font

Technical support for Spire.PDF

Moderator: iceblue support

Text Not showing for an embedded font

Postby jsilva101 » Mon Aug 07, 2017 10:03 pm

I have an application which uses various true type font files for text when generating PDFs. Generally everything works well, but recently we ran into a font file for which the text just does not show up in the final pdf. The Spire.PDF version is 3.8.22.

Code for getting the font looks like:

Code: Select all
Spire.Pdf.Graphics.PdfTrueTypeFont curFont = new Spire.Pdf.Graphics.PdfTrueTypeFont(FontFilePath, 44);


The font file being used should be attached. Any help is appreciated.
Pacifico-Regular.zip

Thank you.
You do not have the required permissions to view the files attached to this post.
jsilva101
 
Posts: 3
Joined: Mon Oct 13, 2014 4:27 pm

Re: Text Not showing for an embedded font

Postby Jane.Bai » Tue Aug 08, 2017 3:31 am

Hello,

Thanks for your inquiry.
After an initial test using the latest hotfix(Spire.PDF Pack(Hot Fix) Version:3.9.266), I didn't encounter the issue you mentioned. Please try this version. Below is my testing code and the result in the attachment.
Code: Select all
 PdfDocument document = new PdfDocument();
            PdfPageBase page = document.Pages.Add();
            String fontFileName = @"Pacifico-Regular.ttf";
              PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(fontFileName, 44f);
            page.Canvas.DrawString("Hello World", trueTypeFont, new PdfSolidBrush(Color.Black), 10, 10);
            document.SaveToFile("11310.pdf", FileFormat.PDF);


If there's still any issue, welcome to write back.

Sincerely,
Jane
E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar
Jane.Bai
 
Posts: 523
Joined: Tue Nov 29, 2016 1:47 am

Re: Text Not showing for an embedded font

Postby Jane.Bai » Wed Aug 09, 2017 6:09 am

Hello,

Thanks for your response.
I have reproduced the issue and referred it to our dev team. Once there's any news, I will let you know.
Sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 523
Joined: Tue Nov 29, 2016 1:47 am

Re: Text Not showing for an embedded font

Postby Jane.Bai » Wed Aug 09, 2017 9:52 am

Hello,

We got the root of the issue. It is because that the font size is 44 and the height of the rectangle is only 55, which is not enough for the occupation of the text. Please change the height of the rectangle to be larger. eg.RectangleF rec = new System.Drawing.RectangleF(63, 400, 500, 250);

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 523
Joined: Tue Nov 29, 2016 1:47 am

Re: Text Not showing for an embedded font

Postby jsilva101 » Wed Aug 09, 2017 4:45 pm

That insight helped me fix the issue.

Thank you very much for the help!
jsilva101
 
Posts: 3
Joined: Mon Oct 13, 2014 4:27 pm

Re: Text Not showing for an embedded font

Postby Jane.Bai » Thu Aug 10, 2017 1:50 am

Hello,

Thanks for your feedback.
Please feel free to contact us if you need any help.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 523
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.PDF

Who is online

Users browsing this forum: No registered users and 1 guest