iTextSharp.text.pdf.PdfContentParser.Parse C# (CSharp) Метод

Parse() публичный Метод

public Parse ( List ls ) : List
ls List
Результат List
        public List<PdfObject> Parse(List<PdfObject> ls)
        {
            if (ls == null)
                ls = new List<PdfObject>();
            else
                ls.Clear();
            PdfObject ob = null;
            while ((ob = ReadPRObject()) != null) {
                ls.Add(ob);
                if (ob.Type == COMMAND_TYPE)
                    break;
            }
            return ls;
        }

Usage Example

Пример #1
0
 private static void ParseCid(String cmapName, AbstractCMap cmap, ICidLocation location, int level) {
     if (level >= MAXLEVEL)
         return;
     PRTokeniser inp = location.GetLocation(cmapName);
     try {
         List<PdfObject> list = new List<PdfObject>();
         PdfContentParser cp = new PdfContentParser(inp);
         int maxExc = 50;
         while (true) {
             try {
                 cp.Parse(list);
             }
             catch {
                 if (--maxExc < 0)
                     break;
                 continue;
             }
             if (list.Count == 0)
                 break;
             String last = list[list.Count - 1].ToString();
             if (level == 0 && list.Count == 3 && last.Equals(DEF)) {
                 PdfObject key = list[0];
                 if (PdfName.REGISTRY.Equals(key))
                     cmap.Registry = list[1].ToString();
                 else if (PdfName.ORDERING.Equals(key))
                     cmap.Ordering = list[1].ToString();
                 else if (CMAPNAME.Equals(key))
                     cmap.Name = list[1].ToString();
                 else if (PdfName.SUPPLEMENT.Equals(key)) {
                     try {
                         cmap.Supplement = ((PdfNumber)list[1]).IntValue;
                     }
                     catch {}
                 }
             }
             else if ((last.Equals(ENDCIDCHAR) || last.Equals(ENDBFCHAR)) && list.Count >= 3) {
                 int lmax = list.Count - 2;
                 for (int k = 0; k < lmax; k += 2) {
                     if (list[k] is PdfString) {
                         cmap.AddChar((PdfString)list[k], list[k + 1]);
                     }
                 }
             }
             else if ((last.Equals(ENDCIDRANGE) || last.Equals(ENDBFRANGE)) && list.Count >= 4) {
                 int lmax = list.Count - 3;
                 for (int k = 0; k < lmax; k += 3) {
                     if (list[k] is PdfString && list[k + 1] is PdfString) {
                         cmap.AddRange((PdfString)list[k], (PdfString)list[k + 1], list[k + 2]);
                     }
                 }
             }
             else if (last.Equals(USECMAP) && list.Count == 2 && list[0] is PdfName) {
                 ParseCid(PdfName.DecodeName(list[0].ToString()), cmap, location, level + 1);
             }
         }
     }
     finally {
         inp.Close();
     }
 }
All Usage Examples Of iTextSharp.text.pdf.PdfContentParser::Parse