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

embed font in pdf

Hi, I am using Syncfusion.Pdf dll to create pdf, and is all ok but i had embed font using this code c#

                            Font font = new Font(new FontFamily(fontnome), 20f, FontStyle.Regular);
                            PdfFont carattere = new PdfTrueTypeFont(font, FontStyle.Regular, (float)Convert.ToDouble(dr_ele[7]), false, true);
but enbed font have this name WCSGIM+//fontname// so acrobat cannot read it.
How can i do?

6 Replies

MA Marco December 23, 2019 05:34 PM UTC

I have to add some info about this tread.
I have checked with fontforge, the info about font enbed, and i see that the font are enbed with this name WCSGIM+//fontname//  and is it correct because for some font fontforge can find all the glifi and bmp, for other like (Museo sans 500) cannot find usable bitmap for this font ttf. So i check this is not a truetypefont but an OpenType .
May be this is the cause of this problem??



AP Anand Panchamoorthi Syncfusion Team December 24, 2019 10:16 AM UTC

Hi Macro, 
  
Thank you for contacting Syncfusion support. 
 
We found that you have enabled the font embedding option and disabled the Unicode support. The open type fonts only support while enabling the Unicode option in the PdfTrueTypeFont instance. Please refer the below code snippet to draw the text using open type font. 
 
PdfFont carattere = new PdfTrueTypeFont(font, FontStyle.Regular, (float)Convert.ToDouble(dr_ele[7]), true, true); 
 
Please try the above solution in your end and let us know whether your requirement is achieved or not. If not please share us the font and sample text to draw it into PDF document. It will helpful for us to provide the precise solution on this. 
  
With Regards, 
Anand Panchamoorthi


MA Marco December 24, 2019 10:48 AM UTC

Hy Anand,
many thanks for your reply. Unfortunatly i Have tried as you tell to me but the font is not correctly embed. As before if I open the file in acrobat or fontforge , I can see the name of the font embed but the font library is missed
The Font is Museo Sans 500, but as my customer tell to me the same with all Museo Sans font.





SL Sowmiya Loganathan Syncfusion Team December 30, 2019 11:16 AM UTC

Hi Macro, 

We have tried with the sample to draw the text using Museo Sans 500 font in PDF document. But the font is embedded properly and preserved in font entries of resultant PDF document. Please refer the below screenshots for more details, 

Output document:  
 

Fonts preserved in PDF document:  
 

Could you please let us know what issue you have faced in your end (i.e., font library is missed and font is not embedded properly). It will be helpful for further analysis and provide the better solution on this.  

Regards, 
Sowmiya Loganathan 



UM umlprog replied to Sowmiya Loganathan December 17, 2021 12:06 PM UTC

We are having same issue.

var font = new Font("Arial", 9, FontStyle.Regular);

// Both below render same results


// Disable unicode. Embed=false. Outputs Arial, but Actual Font reads ArialMT in AcrobatReader

cell.Style.Font = new PdfTrueTypeFont(font, FontStyle.Regular, 9, false, false);


// Displays ArialMT

cell.Style.Font = new PdfTrueTypeFont(font, 9, true);


How can we force Syncfusion to write Arial?




SV Surya Venkatesan Syncfusion Team replied to umlprog December 20, 2021 02:05 PM UTC

Hi umlprog,


Query

Response

We are having same issue.

var font = new Font("Arial", 9, FontStyle.Regular);

// Both below render same results



// Disable unicode. Embed=false. Outputs Arial, but Actual Font reads ArialMT in AcrobatReader

cell.Style.Font = new PdfTrueTypeFont(font, FontStyle.Regular, 9, false, false);

 

// Displays ArialMT

cell.Style.Font = new PdfTrueTypeFont(font, 9, true);

 

How can we force Syncfusion to write Arial?

 

Yes, if you create the PDF with TrueType font - “Arial”, the output document shows ArialMT. Because we are displaying the font postScriptName: ArialMT . So, it's not an issue and you are writing the PDF from the Arial font only so, no need to force to write the Arial font.

 

Kindly refer the following to get more details about Arial,

 

Please let us know if you need any further assistance with this.

 


Regards,

Surya V


Loader.
Live Chat Icon For mobile
Up arrow icon