/// /// Parse the fonts from the page's resources structure including the encoding differences and CMAPs /// public FontResource(string fontName, PdfReference resource, IAdobeGlyphList adobeGlyphList, ILogger logger) { // store some injected services _adobeGlyphList = adobeGlyphList; _logger = logger; var resourceElements = (resource?.Value as PdfDictionary)?.Elements; //Extract the encoding differences array var differences = resourceElements?.GetDictionary("/Encoding")?.Elements?.GetArray("/Differences"); if (differences != null) { _differences = differences; } //Extract the CMAPs var unicodeDictionary = resourceElements?.GetDictionary("/ToUnicode"); var stream = unicodeDictionary?.Stream; if (stream != null) { _cmap = new CMap(stream, fontName, _logger); } }
public PdfSharpTextExtractor(IAdobeGlyphList adobeGlyphList, ILogger logger) { _adobeGlyphList = adobeGlyphList; _logger = logger; FontLookup = new Dictionary <string, FontResource>(); }