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.

Thu Mar 05, 2015 6:05 am

Hi,
I am trying to generate a PDF with a font embedded but it does not seem to embed the font. It is a truetype font and is installed in Windows - the PDf displays the font correctly on this computer. If I open the PDF on a different computer without the font installed, the PDF displays with the incorrect font so I assume it is not embedded. Any idea what I am doing wrong (sample program below)?

If it is possible to get the font embedded then it is likely we would move to a full licence of the product.

We are using FreeSpire.PDF version 3.2
(packages\FreeSpire.PDF.3.2\lib\net40-client\Spire.Pdf.dll)

Many thanks,
Nathan

Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using Spire.Pdf;
using Spire.Pdf.Graphics;

   namespace Font
   {
       class Program
       {
           static void Main(string[] args)
           {
               PdfDocument doc = new PdfDocument();
               PdfPageBase page = doc.Pages.Add();
               PdfBrush brush = new PdfSolidBrush(Color.Red);
                System.Drawing.Font font = new System.Drawing.Font("Rats-Irreverence", 14f, FontStyle.Bold);
               PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font);
                page.Canvas.DrawString("Font Family: Rats-Irreverenc - Embedded", trueTypeFont, brush, 16f, 16f);
               doc.SaveToFile("Font.pdf");
               doc.Close();
               System.Diagnostics.Process.Start("Font.pdf");
           }
       }
   }
Last edited by nathanmf on Thu Mar 05, 2015 10:16 pm, edited 1 time in total.

nathanmf
 
Posts: 3
Joined: Thu Mar 05, 2015 5:50 am

Thu Mar 05, 2015 9:25 am

Hello,

Thanks for your inquiry.
To help us reproduce this issue,please upload the font(“Rats-Irreverence”) you want to embedded to the forum, or you can send it to support@e-iceblue.com
Thanks.

Best Regards,
Betsy
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Mon Mar 09, 2015 2:44 am

Hi Betsy,
I have attached the font and a sample PDF to the original post.
Many thanks,
Nathan

nathanmf
 
Posts: 3
Joined: Thu Mar 05, 2015 5:50 am

Mon Mar 09, 2015 7:52 am

Hello,

I have reproduced your issue the font could not been embedded and posted it to our dev team. Once the issue been resolved, we will inform you immediately.

Best Regards,
Betsy
E-iceblue Support Team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Mar 17, 2015 10:04 pm

Hi Betsy,
any update on the font issue with Spire.PDF? I will move back to generating from HTML to PDF rather than in code. This is not ideal as the result will be a PDF with an image embedded. While this will work for the current need of a one-page document, I hoped to use Spire to generate much larger documents with the paid version in the near future.

Cheers,
Nathan

nathanmf
 
Posts: 3
Joined: Thu Mar 05, 2015 5:50 am

Wed Mar 18, 2015 2:51 am

Thanks for your inquiry.
The issue have been resolved, please download the new version from the following link and use the codes I provide to have a try:
http://www.e-iceblue.com/downloads/temp ... .2.139.zip
Here are my testing codes:
Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
PdfBrush brush = new PdfSolidBrush(Color.Red);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(new Font("Rats-Irreverence", 16), true);
page.Canvas.DrawString("Font Family: Rats-Irreverenc - Embedded", trueTypeFont, brush, 16f, 16f);
doc.SaveToFile("Font4.pdf");
doc.Close();
System.Diagnostics.Process.Start("Font4.pdf");


Thanks for your feedback about our product, we will optimize it.
If there are any questions, welcome to get it back to us.

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Oct 20, 2015 7:35 am

Is the fix for embedding a TrueType or OpenType font included in the Free PDF version available for download currently? It looks like the downloadable version might have been from before the fix was done.

I downloaded the fixed version from the link in this post but that was for the commercial version of Spire.PDF.

Thanks
Julian

julians26
 
Posts: 8
Joined: Thu Oct 15, 2015 1:26 am

Tue Oct 20, 2015 8:43 am

Hi Julian,

The feature is not included in the Free PDF version, please use commercial version of Spire.PDF to test the feature.

Best Regards,
Amy
E-iceblue suppport team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF