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


C# RandomAccessFileOrArray.Read方法代碼示例

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


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

示例1: TestSeek

 virtual public void TestSeek()
 {
     RandomAccessFileOrArray rafoa = new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(data));
     rafoa.Seek(72);
     for (int i = 72; i < data.Length; i++)
     {
         Assert.AreEqual(data[i], (byte)rafoa.Read());
     }
 }
開發者ID:Niladri24dutta,項目名稱:itextsharp,代碼行數:9,代碼來源:RandomAccessFileOrArrayTest.cs

示例2: PdfStamperImp

        /** Creates new PdfStamperImp.
        * @param reader the read PDF
        * @param os the output destination
        * @param pdfVersion the new pdf version or '\0' to keep the same version as the original
        * document
        * @param append
        * @throws DocumentException on error
        * @throws IOException
        */
        internal protected PdfStamperImp(PdfReader reader, Stream os, char pdfVersion, bool append) : base(new PdfDocument(), os) {
            if (!reader.IsOpenedWithFullPermissions)
                throw new BadPasswordException(MessageLocalization.GetComposedMessage("pdfreader.not.opened.with.owner.password"));
            if (reader.Tampered)
                throw new DocumentException(MessageLocalization.GetComposedMessage("the.original.document.was.reused.read.it.again.from.file"));
            reader.Tampered = true;
            this.reader = reader;
            file = reader.SafeFile;
            this.append = append;
            if (reader.IsEncrypted() && (append || PdfReader.unethicalreading)) {
                crypto = new PdfEncryption(reader.Decrypt);
            }
            if (append) {
                if (reader.IsRebuilt())
                    throw new DocumentException(MessageLocalization.GetComposedMessage("append.mode.requires.a.document.without.errors.even.if.recovery.was.possible"));
                pdf_version.SetAppendmode(true);
                if (pdfVersion == 0) {
                    pdf_version.PdfVersion = reader.PdfVersion;
                }
                else {
                    pdf_version.PdfVersion = pdfVersion;
                }
                byte[] buf = new byte[8192];
                int n;
                while ((n = file.Read(buf)) > 0)
                    this.os.Write(buf, 0, n);
                prevxref = reader.LastXref;
                reader.Appendable = true;
            }
            else {
                if (pdfVersion == 0)
                    base.PdfVersion = reader.PdfVersion;
                else
                    base.PdfVersion = pdfVersion;
            }

            if (reader.IsTagged()) {
                this.SetTagged();
            }

            base.Open();
            pdf.AddWriter(this);
            if (append) {
                body.Refnum = reader.XrefSize;
                marked = new IntHashtable();
                if (reader.IsNewXrefType())
                    fullCompression = true;
                if (reader.IsHybridXref())
                    fullCompression = false;
            }
            initialXrefSize = reader.XrefSize;
            ReadColorProfile();
        }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:62,代碼來源:PdfStamperImp.cs

示例3: PdfStamperImp

 /** Creates new PdfStamperImp.
 * @param reader the read PDF
 * @param os the output destination
 * @param pdfVersion the new pdf version or '\0' to keep the same version as the original
 * document
 * @param append
 * @throws DocumentException on error
 * @throws IOException
 */
 internal PdfStamperImp(PdfReader reader, Stream os, char pdfVersion, bool append)
     : base(new PdfDocument(), os)
 {
     if (reader.Tampered)
         throw new DocumentException("The original document was reused. Read it again from file.");
     reader.Tampered = true;
     this.reader = reader;
     file = reader.SafeFile;
     this.append = append;
     if (append) {
         if (reader.IsRebuilt())
             throw new DocumentException("Append mode requires a document without errors even if recovery was possible.");
         if (reader.IsEncrypted())
             crypto = new PdfEncryption(reader.Decrypt);
         pdf_version.SetAppendmode(true);
         file.ReOpen();
         byte[] buf = new byte[8192];
         int n;
         while ((n = file.Read(buf)) > 0)
             this.os.Write(buf, 0, n);
         file.Close();
         prevxref = reader.LastXref;
         reader.Appendable = true;
     }
     else {
         if (pdfVersion == 0)
             base.PdfVersion = reader.PdfVersion;
         else
             base.PdfVersion = pdfVersion;
     }
     base.Open();
     pdf.AddWriter(this);
     if (append) {
         body.Refnum = reader.XrefSize;
         marked = new IntHashtable();
         if (reader.IsNewXrefType())
             fullCompression = true;
         if (reader.IsHybridXref())
             fullCompression = false;
     }
     initialXrefSize = reader.XrefSize;
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:51,代碼來源:PdfStamperImp.cs


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