本文整理匯總了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();
}
}
示例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();
}
}