Method RedactToFile
RedactToFile(string, string, PdfRedactionRequest, PdfRedactionOptions, CancellationToken)
Redacts the PDF at inputPath and writes the
result to outputPath.
public static PdfRedactionReport RedactToFile(string inputPath, string outputPath, PdfRedactionRequest request, PdfRedactionOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputPathstringFile-system path to the source PDF.
outputPathstringDestination path for the redacted document.
requestPdfRedactionRequestWhat to redact.
optionsPdfRedactionOptionsOptional redaction options; defaults are used when
null.cancellationTokenCancellationTokenCancellation token.
Returns
- PdfRedactionReport
A report describing what was removed.
Exceptions
- ArgumentException
Thrown when a path is null or whitespace.
- ArgumentNullException
Thrown when
requestis null.- FileNotFoundException
Thrown when
inputPathdoes not exist.- PdfDocumentException
Thrown when the source cannot be parsed, the password is wrong, or a page could not be processed.
RedactToFile(byte[], string, PdfRedactionRequest, PdfRedactionOptions, CancellationToken)
Redacts in-memory PDF bytes and writes the result to
outputPath.
public static PdfRedactionReport RedactToFile(byte[] pdfData, string outputPath, PdfRedactionRequest request, PdfRedactionOptions options = null, CancellationToken cancellationToken = default)
Parameters
pdfDatabyte[]outputPathstringrequestPdfRedactionRequestoptionsPdfRedactionOptionscancellationTokenCancellationToken
Returns
RedactToFile(Stream, string, PdfRedactionRequest, PdfRedactionOptions, CancellationToken)
Redacts the PDF read from inputStream and
writes the result to outputPath.
public static PdfRedactionReport RedactToFile(Stream inputStream, string outputPath, PdfRedactionRequest request, PdfRedactionOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputStreamStreamoutputPathstringrequestPdfRedactionRequestoptionsPdfRedactionOptionscancellationTokenCancellationToken
Returns
RedactToFile(Attachment, string, PdfRedactionRequest, PdfRedactionOptions, CancellationToken)
Redacts the PDF carried by attachment and
writes the result to outputPath.
public static PdfRedactionReport RedactToFile(Attachment attachment, string outputPath, PdfRedactionRequest request, PdfRedactionOptions options = null, CancellationToken cancellationToken = default)
Parameters
attachmentAttachmentoutputPathstringrequestPdfRedactionRequestoptionsPdfRedactionOptionscancellationTokenCancellationToken