當前位置: 首頁>>代碼示例>>C#>>正文


C# PRTokeniser.Seek方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PRTokeniser.Seek方法的典型用法代碼示例。如果您正苦於以下問題:C# PRTokeniser.Seek方法的具體用法?C# PRTokeniser.Seek怎麽用?C# PRTokeniser.Seek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PRTokeniser的用法示例。


在下文中一共展示了PRTokeniser.Seek方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadObjStm

 virtual protected internal void ReadObjStm(PRStream stream, IntHashtable map) {
     if (stream == null) return;
     int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
     int n = stream.GetAsNumber(PdfName.N).IntValue;
     byte[] b = GetStreamBytes(stream, tokens.File);
     PRTokeniser saveTokens = tokens;
     tokens = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(b)));
     try {
         int[] address = new int[n];
         int[] objNumber = new int[n];
         bool ok = true;
         for (int k = 0; k < n; ++k) {
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
                 ok = false;
                 break;
             }
             objNumber[k] = tokens.IntValue;
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
                 ok = false;
                 break;
             }
             address[k] = tokens.IntValue + first;
         }
         if (!ok)
             throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
         for (int k = 0; k < n; ++k) {
             if (map.ContainsKey(k)) {
                 tokens.Seek(address[k]);
                 tokens.NextToken();
                 PdfObject obj;
                 if (tokens.TokenType == PRTokeniser.TokType.NUMBER) {
             	    obj = new PdfNumber(tokens.StringValue);
                 }
                 else {
             	    tokens.Seek(address[k]);
             	    obj = ReadPRObject();
                 }
                 xrefObj[objNumber[k]] = obj;
             }
         }            
     }
     finally {
         tokens = saveTokens;
     }
 }
開發者ID:,項目名稱:,代碼行數:51,代碼來源:

示例2: ReadOneObjStm

 protected internal PdfObject ReadOneObjStm(PRStream stream, int idx) {
     int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
     byte[] b = GetStreamBytes(stream, tokens.File);
     PRTokeniser saveTokens = tokens;
     tokens = new PRTokeniser(b);
     try {
         int address = 0;
         bool ok = true;
         ++idx;
         for (int k = 0; k < idx; ++k) {
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
                 ok = false;
                 break;
             }
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
                 ok = false;
                 break;
             }
             address = tokens.IntValue + first;
         }
         if (!ok)
             throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
         tokens.Seek(address);
         return ReadPRObject();
     }
     finally {
         tokens = saveTokens;
     }
 }
開發者ID:pusp,項目名稱:o2platform,代碼行數:35,代碼來源:PdfReader.cs

示例3: ReadOneObjStm

		virtual protected internal PdfObject ReadOneObjStm (PRStream stream, int idx) {
            int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
            byte[] b = GetStreamBytes(stream, tokens.File);
            PRTokeniser saveTokens = tokens;
            tokens = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(b)));
            try {
				int address = 0;
                bool ok = true;
                ++idx;
                for (int k = 0; k < idx; ++k) {
                    ok = tokens.NextToken();
                    if (!ok)
                        break;
                    if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
                        ok = false;
                        break;
                    }
                    ok = tokens.NextToken();
                    if (!ok)
                        break;
                    if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
                        ok = false;
                        break;
                    }
                    address = tokens.IntValue + first;
                }
                if (!ok)
                    throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
                tokens.Seek(address);
                tokens.NextToken();
                PdfObject obj;
                if (tokens.TokenType == PRTokeniser.TokType.NUMBER) {
                    obj = new PdfNumber(tokens.StringValue);
                }
                else {
                    tokens.Seek(address);
                    obj = ReadPRObject();
                }
                return obj;
            }
            finally {
                tokens = saveTokens;
            }
        }
開發者ID:,項目名稱:,代碼行數:44,代碼來源:

示例4: ReadObjStm

 protected internal void ReadObjStm(PRStream stream, IntHashtable map) {
     int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
     int n = stream.GetAsNumber(PdfName.N).IntValue;
     byte[] b = GetStreamBytes(stream, tokens.File);
     PRTokeniser saveTokens = tokens;
     tokens = new PRTokeniser(b);
     try {
         int[] address = new int[n];
         int[] objNumber = new int[n];
         bool ok = true;
         for (int k = 0; k < n; ++k) {
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
                 ok = false;
                 break;
             }
             objNumber[k] = tokens.IntValue;
             ok = tokens.NextToken();
             if (!ok)
                 break;
             if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
                 ok = false;
                 break;
             }
             address[k] = tokens.IntValue + first;
         }
         if (!ok)
             throw new InvalidPdfException("Error reading ObjStm");
         for (int k = 0; k < n; ++k) {
             if (map.ContainsKey(k)) {
                 tokens.Seek(address[k]);
                 PdfObject obj = ReadPRObject();
                 xrefObj[objNumber[k]] = obj;
             }
         }            
     }
     finally {
         tokens = saveTokens;
     }
 }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:42,代碼來源:PdfReader.cs


注:本文中的iTextSharp.text.pdf.PRTokeniser.Seek方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。