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


C# PdfReader.?.Close方法代碼示例

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


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

示例1: PdfInfo

        public PdfInfo(string file)
        {     
            try
            {
                reader = new PdfReader(file);

                NumberOfPages = reader.NumberOfPages;
                SignatureNames = reader.AcroFields.GetSignatureNames().AsReadOnly();
            }
            catch (Exception e)
            {
                throw new ReadingPdfInfoFailedException($"Failed to read information from pdf file {file}", e);
            }
            finally
            {
                reader?.Close();
            }
        }
開發者ID:affecto,項目名稱:dotnet-Pdf.Toolkit,代碼行數:18,代碼來源:PdfInfo.cs

示例2: SignDocument

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="chain"></param>
        /// <param name="pks"></param>
        /// <param name="subfilter"></param>
        /// <param name="reason"></param>
        /// <param name="location"></param>
        /// <param name="crlList"></param>
        /// <param name="ocspClient"></param>
        /// <param name="tsaClient"></param>
        /// <param name="estimatedSize"></param>
        /// <returns></returns>
        private static byte[] SignDocument(String input,
                         ICollection<Org.BouncyCastle.X509.X509Certificate> chain,
                         IExternalSignature pks,
                         CryptoStandard subfilter,
                         String reason, String location,
                         ICollection<ICrlClient> crlList,
                         IOcspClient ocspClient,
                         ITSAClient tsaClient,
                         int estimatedSize)
        {
            using (var stream = new MemoryStream())
            {
                // Creating the reader and the stamper
                PdfReader reader = null;
                PdfStamper stamper = null;
                try
                {
                    reader = new PdfReader(input);
                    stamper = PdfStamper.CreateSignature(reader, stream, '\0');

                    // Creating the appearance
                    PdfSignatureAppearance appearance = stamper.SignatureAppearance;
                    appearance.Reason = reason;
                    appearance.Location = location;
                    //appearance.SetVisibleSignature(new Rectangle(36, 748, 144, 780), 1, "sig");

                    // Creating the signature
                    MakeSignature.SignDetached(appearance, pks, chain, crlList, ocspClient, tsaClient, estimatedSize, subfilter);
                }
                finally
                {
                    reader?.Close();
                    stamper?.Close();
                }

                return stream.GetBuffer();
            }
        }
開發者ID:PavelHryzlik,項目名稱:PAdES_LTVSigner,代碼行數:52,代碼來源:PAdES_LTVSigner.cs


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