PdfDocument.OpenAsync(String, OpenOptions, CancellationToken) Method
Loads a PDF file from a file path asynchronously.
public static Task<PdfDocument> OpenAsync( string path, OpenOptions? options = null, CancellationToken cancellationToken = default )
Parameters
- path String
- Path to PDF file to open.
- options OpenOptions (Optional)
- Additional options for loading the PDF.
- cancellationToken CancellationToken (Optional)
- Token for monitoring cancellation requests.
Return Value
Task<PdfDocument>PdfDocument for the specified file.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | path is null. |
ArgumentException | path is empty. |
IOException | An IO error occured while reading the file. |
FileNotFoundException | No file was found at path. |
InvalidCredentialException | The input PDF is encrypted, but an incorrect password was specified, or not specified at all. |
PdfException | The input PDF could not be parsed. |