Hello,
I have been able to extract font from a PDF, extract text then use the font to display text on screen. (using skia sharp for display)
However I can’t do the same if the font encoding is custom or built-in. Characters are substituted by others or simply left blanks.
I was expecting to find the correct index for given character using Font.GetGlyphsForText(“simple”) but it only returns 0 indexes.
Obviously you are able to deal with those built-in encoding inside aspose since you can extract the text as unicode, generate SVG or render the image without problem. But do you expose somewhere a method or index table that could help me make use of these fonts?
Here is a simple sample with built-in encoding.
simple.pdf (9.8 KB)
We are afraid that Aspose.PDF does not provide any method or expose any interface to deal with the font files. We can investigate however w.r.t Aspose.Font API. Do you have such font in TTF or any format? If yes, would you please share it with us? We will log an investigation ticket and share the ID with you.
Here is the font extracted from the PDF above.
PHQGHU+Calibri.zip (7.3 KB)
Is the encoding information lost in the Aspose.PDF object before I load it in Aspose Font?
I used a code like this
var fonts = pdfDocument?.FontUtilities.GetAllFonts(); // << Aspose.Pdf
foreach (var font in fonts)
{
var ms = new MemoryStream();
font.Save(ms);
StreamSource ss = new ByteContentStreamSource(ms.GetBuffer());
var fd = new FontDefinition(FontType.TTF, ss);
var ttfFont = Font.Open(fd) as TtfFont; // << Aspose.Font
outFont.SaveToFormat(fs, FontSavingFormats.TTF);
}
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): FONTNET-676
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.