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

Embedding font - existing pdf

Hi,
I have a question:
I need to embed fonts in an existing pdf.

If I use:

Font fnt = new Font("c:\\Arial.ttf", 12f);
PdfFont font = new PdfTrueTypeFont( fnet, true);
page.Graphics.DrawString("Embedded font", font, brush, 0,100);

I can embed fonts in a new pdf, but for an existing one?
tnx.

7 Replies

AG Angappan G Syncfusion Team May 3, 2010 12:04 PM UTC

Hi Barbara,

Thank you for your interest in Essential Pdf.

We can embed the fonts into an existing pdf file using the following code snippet

PdfLoadedDocument ldoc = new PdfLoadedDocument("../Data/Fonts.pdf");

PdfFont font = new PdfTrueTypeFont("../Data/CENTURY.TTF", 12f);

PdfLoadedPage lpage = ldoc.Pages[0] as PdfLoadedPage;

lpage.Graphics.DrawString("Embedded Font", font, brush,location);

Please try this and let us know if you have any queries.

Regards,
Angappan.


BT Barbara Tacchino May 6, 2010 10:16 AM UTC

Ok, but in this way I can add an embedded font.
I've an existing pdf with standard fonts (no embedded) and I need replace every font with the embedded one.
Can you help me?


AG Angappan G Syncfusion Team May 7, 2010 09:50 AM UTC

Hi Barbara

It is not possible to replace the existing fonts with the embedded fonts because "Fonts" are XObjects in PDF.To embed the new fonts, the existing standard font entries must be deleted,but it is not possible to delete the Xobjects in the PDF once they were added.

Please let us know if you have any queries.

Regards,
Angappan.


BS Brent Snyder February 8, 2013 04:37 PM UTC

Just wondering if you had any future plans on this topic?  Aspose, does allow to cycle through fonts that are not embedded and set a property to embed them.

Brent


GL George Livingston Syncfusion Team February 14, 2013 10:27 AM UTC

Hi Brent,

Thank you for your update.

This feature request for “Need to add support to embed the non-embedded font in the PDF Document” has been added. We will let you know once the feature has been implemented.

Please let us know if you have any questions.

Regards,
George



MB Mike Burgess January 2, 2014 04:00 PM UTC

Has this ever been added? or is there some code that will find the list of fonts in the PDF so that they can then be added?


PH Praveenkumar H Syncfusion Team January 7, 2014 03:41 AM UTC

Hi Mike,

Thank you for your interest in Syncfusion products,

Still feature request  “Need to add support to embed the non-embedded font in the PDF Document” is not implemented. We will let you know once the feature has been implemented.

Please let us know if you have any questions.

Regards,
Praveen

Loader.
Live Chat Icon For mobile
Up arrow icon