public static void ReadFonts()
{
Document pdf = new Document(@"testfont.pdf");
Aspose.Pdf.Text.Font[] fonts = pdf.FontUtilities.GetAllFonts();
foreach (Aspose.Pdf.Text.Font font in fonts)
{
Console.WriteLine($"font name : {font.FontName} DecodedFontName : {font.DecodedFontName}" );
}
pdf.Dispose();
}
it produce this output :
font name : Calibri DecodedFontName : BCDEEE+Calibri
font name : Calibri-Bold DecodedFontName : BCDFEE+Calibri-Bold
font name : Calibri-LightItalic DecodedFontName :
font name : Calibri-LightItalic DecodedFontName : BCDHEE+Calibri-LightItalic
font name : Calibri-BoldItalic DecodedFontName : BCDIEE+Calibri-BoldItalic
font name : Calibri DecodedFontName :
We tested the scenario in our environment and were able replicate the issue. Therefore, have logged it as PDFNET-49496 in our issue tracking system for the sake of further investigation. However, please note that the issue is logged under free support model where issues are resolved on first come first serve basis. We have logged your concerns along with the ticket as well and will surely inform you as soon as we have further updates regarding its resolution. Please be patient and give us some time.
Thanks, I tried Aspose PDF.net 21.4 but I don’t get what I expect.
Now i gotrthis :
font name : Calibri DecodedFontName : Calibri
font name : Calibri-Bold DecodedFontName : Calibri-Bold
font name : Calibri-LightItalic DecodedFontName : Calibri-LightItalic
font name : Calibri-LightItalic DecodedFontName : Calibri-LightItalic
font name : Calibri-BoldItalic DecodedFontName : Calibri-BoldItalic
font name : Calibri DecodedFontName : Calibri
Now I get only the font name in the decoded font name and i need the full DecodedFontName with the prefix (example : BCDEEE+) like here :
font name : Calibri DecodedFontName : BCDEEE+Calibri
font name : Calibri-Bold DecodedFontName : BCDFEE+Calibri-Bold
font name : Calibri-LightItalic DecodedFontName : BCDGEE+Calibri-LightItalic
font name : Calibri-LightItalic DecodedFontName : BCDHEE+Calibri-LightItalic
font name : Calibri-BoldItalic DecodedFontName : BCDIEE+Calibri-BoldItalic
font name : Calibri DecodedFontName : BCDJEE+Calibri
So this fix is useless to me
Can you check and fix it again in this direction ?
Thanks
We have recorded it and will further look into the details of the ticket accordingly. We will inform you once we have additional updates in this regard.
The point is that value of DecodedFontName property does not mean “the full font name with the prefix” (like BCDEEE+…).
DecodedFontName Property Description:
Sometimes PDF fonts (usually Chinese/Japanese/Korean fonts) could have specific font name. This name is the value of PDF font property BaseFont and sometimes this property could be represented in hexadecimal form. If read this name directly it could be represented in non-readable form. To get readable form it is necessary to decode the font name by rules specific for this font.
This property returns decoded font name, so use it for cases when you meet with a non-readable FontName.
If property FontName has readable form, this property will be the same as FontName, so you can use this property for any cases when you need to get font name in a readable form.
Previously DecodedFontName sometimes returned full name. But that was a side effect of previous incorrect implementation: attempting of decoding internal BaseFont value when its actually not encoded.
The full name (aka BaseFont value, aka “PostScript name” according to p. 9.6.3 of PDF Specification) currently is not available from API of Font class. We have created PDFNET-49791 to make it available for users. ETA is Aspose.PDF 21.5.
We are afraid that we cannot offer build preview before. The next version is scheduled to be released in the first week of next month i.e. May 2021. We will surely inform you as soon as the release is out.