Free Support Forum - aspose.com

How to add substitution fonts using Aspose

Hi everybody,

I want to add some substitution fonts in my PDFs and set whether these fonts are embedded and the encoding method of these fonts(IDENTITY_H/IDENTITY_V). Is there any method in Aspose Library that I can use? I find a methond called Facades.FormattedText, but I was wondering if it is the right method I want. If I have a PDF which already has many test fields, can anyone give me an example or snippet on how to add an extra fonts and make it embedded in the PDF?

Regards,

Jason

Hi Jason,


Thanks for contacting support.

The FormattedText class is used to instantiate an object so that it can be added as watermark stamp. However as per your requirement, you may consider visiting following links for required information on


Thans a lot. How about encoding? How can I set the encoding to IDENTITY_V or IDENTITY_H?

Hi Jason,


Thanks for sharing the details.

I am afraid the requested feature to set encoding of font as IDENTITY_V or IDENTITY_H is
currently not supported but for the sake of implementation, I have logged this
requirement in our issue tracking system under New Features list as PDFNEWNET-39227.
We will further investigate this requirement in details and will keep you
updated on the status of a correction.

We apologize for your inconvenience.

@Hongyuan

Thanks for your patience.

Regarding earlier logged ticket (PDFNET-39227), setting font encoding is not recommended and we cannot implement this in our API. Please note that PDF document can include different types of fonts and only one kind of these fonts - named composite or Type0 fonts can have this encoding (i.e IDENTITY). Each font have its own identity set which is compatible with that font and if we change this IDENTITY, the PDF document will get corrupted.

Current custom font substitution in Aspose.PDF (using FontRepository.Substitutions) works
in a declarative manner. It changes original font name with a new font name in PDF document, so Adobe Acrobat or another PDF viewer will use another font to show text. Font encoding and other data related to font are not changed.This declarative font substitution possibly can cause problems, when new font is not fully compatible with original font.

But change (set) of font encoding will not solve these problems. Serious change of font data and document content is needed to solve them. However, in case you face any font substitution issue or text is not rendering correctly inside your PDF, you may please share your sample PDF document and code snippet with us. We will investigate the scenario accordingly and share our feedback with you.