Class BatchSigner
- Namespace
- SimpleSign.PAdES.Signing
- Assembly
- SimpleSign.PAdES.dll
High-performance batch signer that reuses certificate, HTTP connections, and TSA sessions to sign multiple PDFs efficiently.
public sealed class BatchSigner : IAsyncDisposable
- Inheritance
-
BatchSigner
- Implements
- Inherited Members
Properties
AverageElapsedMs
Average signing time per document in milliseconds.
public double AverageElapsedMs { get; }
Property Value
FailureCount
Number of PDFs that failed to sign.
public int FailureCount { get; }
Property Value
SuccessCount
Number of PDFs successfully signed.
public int SuccessCount { get; }
Property Value
Methods
Create(X509Certificate2)
Creates a new BatchSigner.BatchSignerBuilder for configuring the batch signer.
public static BatchSigner.BatchSignerBuilder Create(X509Certificate2 certificate)
Parameters
certificateX509Certificate2
Returns
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
ResetMetrics()
Resets the success/failure counters and average elapsed time.
public void ResetMetrics()
SignAllAsync(IAsyncEnumerable<(string Id, byte[] PdfBytes)>, CancellationToken)
Signs all PDFs from an async enumerable, yielding results as they complete. Respects SimpleSign.PAdES.Signing.BatchSigner.BatchSignerBuilder.MaxConcurrency for parallel execution.
public IAsyncEnumerable<BatchSignResult> SignAllAsync(IAsyncEnumerable<(string Id, byte[] PdfBytes)> inputs, CancellationToken cancellationToken = default)
Parameters
inputsIAsyncEnumerable<(string Id, byte[] PdfBytes)>Async enumerable of (identifier, PDF bytes) pairs.
cancellationTokenCancellationTokenCancellation token.
Returns
- IAsyncEnumerable<BatchSignResult>
Async enumerable of batch results.
SignAsync(byte[], CancellationToken)
Signs a single PDF and returns the signed bytes.
public Task<byte[]> SignAsync(byte[] pdfBytes, CancellationToken cancellationToken = default)
Parameters
pdfBytesbyte[]Input PDF bytes.
cancellationTokenCancellationTokenCancellation token.
Returns
SignAsync(Stream, Stream, CancellationToken)
Signs a single PDF using the pre-configured certificate and options.
public Task SignAsync(Stream pdfStream, Stream outputStream, CancellationToken cancellationToken = default)
Parameters
pdfStreamStreamSeekable input PDF stream.
outputStreamStreamOutput stream for the signed PDF.
cancellationTokenCancellationTokenCancellation token.