iTextSharp.text.pdf.fonts.cmaps.CMapToUnicode.Lookup C# (CSharp) Method

Lookup() public method

public Lookup ( byte code, int offset, int length ) : String
code byte
offset int
length int
return String
        public String Lookup( byte[] code, int offset, int length )
        {
            String result = null;
            int key = 0;
            if ( length == 1 ) {
                key = code[offset] & 0xff;
                singleByteMappings.TryGetValue(key, out result);
            }
            else if ( length == 2 ) {
                int intKey = code[offset] & 0xff;
                intKey <<= 8;
                intKey += code[offset+1] & 0xff;
                doubleByteMappings.TryGetValue( intKey, out result );
            }
            return result;
        }

Usage Example

Esempio n. 1
0
 private void CheckInsertAndRetrieval(byte[] bytes, string uni)
 {
     CMapToUnicode c = new CMapToUnicode();
     c.AddChar(new PdfString(bytes), new PdfString(uni, "UTF-16BE"));
     string lookupResult = c.Lookup(bytes, 0, bytes.Length);
     Assert.AreEqual(uni, lookupResult);
 }