/**
         * Parses the ToUnicode entry, if present, and constructs a CMap for it
         * @since 2.1.7
         */
        private void ProcessToUnicode()
        {
            PdfObject toUni = PdfReader.GetPdfObjectRelease(fontDic.Get(PdfName.TOUNICODE));
            if (toUni is PRStream){

                try {
                    byte[] touni = PdfReader.GetStreamBytes((PRStream)toUni);

                    CMapParser cmapParser = new CMapParser();
                    toUnicodeCmap = cmapParser.Parse(new MemoryStream(touni));
                } catch {
                    // technically, we should log this or provide some sort of feedback... but sometimes the cmap will be junk, but it's still possible to get text, so we don't want to throw an exception
                    //throw new IllegalStateException("Unable to process ToUnicode map - " + e.GetMessage(), e);
                }
            }
        }
예제 #2
0
 private CMap ProcessToUnicode()
 {
     CMap cmapRet = null;
     PdfObject toUni = PdfReader.GetPdfObjectRelease(this.font.Get(PdfName.TOUNICODE));
     if (toUni is PRStream) {
         try {
             byte[] touni = PdfReader.GetStreamBytes((PRStream)toUni);
             CMapParser cmapParser = new CMapParser();
             cmapRet = cmapParser.Parse(new MemoryStream(touni));
         } catch {
         }
     }
     return cmapRet;
 }