Method GetFields
GetFields(string, CancellationToken)
Reads the form fields of the PDF at inputPath.
public static PdfFormSnapshot GetFields(string inputPath, CancellationToken cancellationToken = default)
Parameters
inputPathstringFile-system path to the source PDF.
cancellationTokenCancellationTokenCancellation token.
Returns
- PdfFormSnapshot
A snapshot of every form field widget; empty when the document carries no form.
Exceptions
- ArgumentException
Thrown when the path is null or whitespace.
- FileNotFoundException
Thrown when
inputPathdoes not exist.- PdfDocumentException
Thrown when the source cannot be parsed or is password protected.
GetFields(byte[], CancellationToken)
Reads the form fields of in-memory PDF bytes.
public static PdfFormSnapshot GetFields(byte[] pdfData, CancellationToken cancellationToken = default)
Parameters
pdfDatabyte[]The complete PDF file.
cancellationTokenCancellationTokenCancellation token.
Returns
- PdfFormSnapshot
A snapshot of every form field widget; empty when the document carries no form.
Exceptions
- ArgumentNullException
Thrown when
pdfDatais null.- PdfDocumentException
Thrown when the source cannot be parsed or is password protected.
GetFields(Attachment, CancellationToken)
Reads the form fields of the PDF carried by
attachment.
public static PdfFormSnapshot GetFields(Attachment attachment, CancellationToken cancellationToken = default)
Parameters
attachmentAttachmentThe attachment carrying the PDF.
cancellationTokenCancellationTokenCancellation token.
Returns
- PdfFormSnapshot
A snapshot of every form field widget; empty when the document carries no form.
Exceptions
- ArgumentNullException
Thrown when
attachmentis null.- PdfDocumentException
Thrown when the source cannot be parsed or is password protected.