Method ParseAsync
ParseAsync(string, CancellationToken)
Asynchronously parses the document at path.
public Task<ParsedDocument> ParseAsync(string path, CancellationToken cancellationToken = default)
Parameters
pathstringPath of the document to parse: a PDF, an image, or any format Attachment opens.
cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- Task<ParsedDocument>
A task whose result is the parsed document.
Exceptions
- ArgumentException
pathis null or empty.- FileNotFoundException
No file exists at
path.- ObjectDisposedException
The parser has been disposed.
ParseAsync(Attachment, CancellationToken)
Asynchronously parses every page of document.
public Task<ParsedDocument> ParseAsync(Attachment document, CancellationToken cancellationToken = default)
Parameters
documentAttachmentThe document to parse. It stays with the caller, who keeps it open until the task completes.
cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- Task<ParsedDocument>
A task whose result is the parsed document.
Exceptions
- ArgumentNullException
documentis null.- ObjectDisposedException
The parser has been disposed.
ParseAsync(string, string, CancellationToken)
Asynchronously parses the pages of the document at path that pageRange selects.
public Task<ParsedDocument> ParseAsync(string path, string pageRange, CancellationToken cancellationToken = default)
Parameters
pathstringPath of the document to parse: a PDF, an image, or any format Attachment opens.
pageRangestringThe pages to parse, 1-based (Parse(string, string, CancellationToken)); null for every page.
cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- Task<ParsedDocument>
A task whose result is the parsed document.
Exceptions
- ArgumentException
pathis null or empty.- FileNotFoundException
No file exists at
path.- ObjectDisposedException
The parser has been disposed.
ParseAsync(Attachment, string, CancellationToken)
Asynchronously parses the pages of document that pageRange selects.
public Task<ParsedDocument> ParseAsync(Attachment document, string pageRange, CancellationToken cancellationToken = default)
Parameters
documentAttachmentThe document to parse. It stays with the caller, who keeps it open until the task completes.
pageRangestringThe pages to parse, 1-based (Parse(string, string, CancellationToken)); null for every page.
cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- Task<ParsedDocument>
A task whose result is the parsed document.
Exceptions
- ArgumentNullException
documentis null.- ObjectDisposedException
The parser has been disposed.