Hi there. I have a problem. I try to embed fonts in existing pdf, but some italic and bold text is shown wrong.
I have next pdf document (without embedded fonts): pdf WITHOUT fonts.PNG
Everything looks like I expect because I have installed fonts:
-Arial Unicode MS Bold
-Arial Unicde MS Regular
-ocrb10
Then I embeds all fonts with next code: pdfDoc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetAllFonts)
In order to embed fonts, you can use IsEmbeded property of the Font class to embed full font and IsSubset property to embed a subset of the font. Please refer to this code example: Embedding Fonts in an existing PDF file. You can use SubsetFonts method to reduce a fully embedded font set to only subsets. However, if the above code example does not help, then kindly share all details of the scenario, including source PDF and code. We will investigate and share our findings with you.
Ok. Thanks. I will try but now I have one more question about SubsetFonts method. There is a parameter ‘subsetStrategy’:
SubsetEmbeddedFontsOnly - case which you described - reduce a full ebedded font set to only subsets
SubsetAllFonts - ??? - as I see it is also used to embed missing fonts and subset them. Am I wrong?
Still doesn’t work. Sources (4.7 KB)
Program.cs - console application for embedding fonts.There are 2 methods - EmbedFonts1 (by your recommendation) and EmbedFonts2 (my assumption)
input-pdf-where-some-fonts-are-not-embedded.pdf - pdf file which I want embed fonts.
Version of Aspose.Pdf.dll - 17.12.0.0
You can trim down fonts used by PDF document to subsets, this functionality to control font subsetting is declared in interface Document.IDocumentFontUtilities. Every object of type Aspose.Pdf.Document has property FontUtilities of type IDocumentFontUtilities. This interface includes method SubsetFonts (FontSubsetStrategy subsetStrategy).
Parameter subsetStrategy helps to tune subset strategy. Two variants of font subsetting are supported. It is possible to subset all fonts used by the document(strategy SubsetAllFonts) or to subset only fully embedded fonts (or font subsets which are larger than it required by current document). In case 1(SubsetAllFonts) all fonts will be embedded into the document. Font subset is embedded into the PDF document by definition, but in case 2(SubsetEmbeddedFontsOnly) process will not affect fonts which are not embedded in the document.
The view of your source PDF is different in Acrobat reader and Chrome browser. Anyways, we have logged an investigation under the ticket ID PDFNET-43888 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.