public string GetHexCharCode(int glyph) { if (ToUnicode != null) { if (!ToUnicode.ContainsGlyph(glyph)) { throw new InvalidOperationException("Glyphs cannot be added to an existing CMap"); } return((new PdfHexString(ToUnicode.FromGlyph(glyph))).Text); } return(null); }
public bool TryGetUnicode(int characterCode, out string value) { value = null; if (!ToUnicode.CanMapToUnicode) { if (ucs2CMap != null && ucs2CMap.TryConvertToUnicode(characterCode, out value)) { return(value != null); } return(false); } // According to PdfBox certain providers incorrectly using Identity CMaps as ToUnicode. if (ToUnicode.IsUsingIdentityAsUnicodeMap) { value = new string((char)characterCode, 1); return(true); } return(ToUnicode.TryGet(characterCode, out value)); }