Free Support Forum - aspose.com

Always embed : simsun font - PDF configuration

Hi,

Currently in our Adobe Distiller PDF setting, we set 'SimSun' font in the 'Always Embed' listbox. Please refer to the attachment for details.

How do we achieve the same setting using Aspose PDF ?

Regards,

hadi teo

Hi Hadi,


Aspose.Pdf for .NET supports the feature to embed full fonts as well as sub-set of fonts while creating PDF documents. Please visit the following link for further information on Fonts embedding while creating PDF

Hi,


The following documentation is applicable for PDFGenerator. Because in my scenario, i am saving an Aspose.Words document into PDF and subsequently use Aspose.PDF to load it and perform some manipulation, should i embed the required font at Aspose.Words or Aspose.PDF ?

Is there any code example to embed it directly at Aspose.Words level ?

For your information, i am not using Aspose PDF Generator.

Regards,

hadi teo

Hi Hadi,


I am moving this thread to Aspose.Words forum so that my fellow worker from respective team can share the required information.

Hi Hadi,


Thanks for your inquiry. I am a representative from Aspose.Words team.

Sure, you can use PdfSaveOptions.EmbedFullFonts property to control how fonts are embedded into the resulting PDF documents. Please run the following code snippet that demonstrates how to set Aspose.Words to embed full fonts in the output PDF document.

// Load the document to render.

Document doc = new Document(MyDir + "Rendering.doc");

// Aspose.Words embeds full fonts by default when EmbedFullFonts is set to true. The property below can be changed

// each time a document is rendered.

PdfSaveOptions options = new PdfSaveOptions();

options.EmbedFullFonts = true;

// The output PDF will be embedded with all fonts found in the document.

doc.Save(MyDir + "Rendering.EmbedFullFonts Out.pdf");


I hope, this helps.

Best regards,

Hi Awais,

May i know whether the following code is correct ? The Save method didn't accept any PdfSaveOptions object ?

// The output PDF will be embedded with all fonts found in the document.<?XML:NAMESPACE PREFIX = O />

doc.Save(MyDir + "Rendering.EmbedFullFonts Out.pdf");

Regards,

hadi teo

Hi Awais,

I have tested the EmbedFullFonts=true option. In my experiment, i tried to remove a font called 'Simsun' and then i tested whether Aspose can embed this font.

Here are the results:

1) Aspose will substitute this font with other fonts when this font is not available when saving Aspose.Word.Document object into PDF. You can refer to the following thread:

http://www.aspose.com/community/forums/permalink/434218/434218/showthread.aspx#434218

2) When using EmbedFullFonts=true, the PDF file size is very big. Even though i use this option, Aspose still cannot render this font correctly when this font is not available inside the system (Refer to the explanation number 1).

Is there any other alternative way that you can propose ?

Regards,

hadi teo

Hi Hadi,


Thanks for your inquiry.
Hadi:
May i know whether the following code is correct ? The Save method didn’t accept any PdfSaveOptions object ?

// The output PDF will be embedded with all fonts found in the document.
doc.Save(MyDir + “Rendering.EmbedFullFonts Out.pdf”);

I am sorry for the confusion. Please just pass the options object to the save method as follows:

// The output PDF will be embedded with
all fonts found in the document.

doc.Save(MyDir + "Rendering.EmbedFullFonts Out.pdf", options);


Best regards,

Hi Hadi,


The default value of PdfSaveOptions.EmbedFullFonts property is false, which means the fonts are subsetted before embedding. Subsetting is useful if you want to keep the output file size smaller because it removes all unused glyphs from a font.

When you set PdfSaveOptions.EmbedFullFonts property to true, a complete font file is embedded into PDF without subsetting. This will result in larger output files, but this can be a useful option when you want to edit the resulting PDF later (e.g. add more text).

Some fonts are large (several megabytes) and embedding them without subsetting will result in large output documents.

Moreover, Aspose.Words might ignore this setting and embed a full font if the font is not subsettable.

Could you please also attach your input Word document here for testing? I will investigate the Fonts issue on my side and provide you more information.

Best regards,