Method Parse
Parse(string, CancellationToken)
Parses the document at path.
public ParsedDocument Parse(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
- ParsedDocument
The parsed document.
Exceptions
- ArgumentException
pathis null or empty.- FileNotFoundException
No file exists at
path.- ObjectDisposedException
The parser has been disposed.
- OperationCanceledException
The parse was canceled.
Parse(Attachment, CancellationToken)
Parses every page of document.
public ParsedDocument Parse(Attachment document, CancellationToken cancellationToken = default)
Parameters
documentAttachmentThe document to parse. It stays with the caller.
cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- ParsedDocument
The parsed document.
Exceptions
- ArgumentNullException
documentis null.- ObjectDisposedException
The parser has been disposed.
- OperationCanceledException
The parse was canceled.
Parse(string, string, CancellationToken)
Parses the pages of the document at path that pageRange selects.
public ParsedDocument Parse(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:
"3","1-5","5-","1-3, 7, 10-12"; null, empty or"*"for every page. Pages outside the document are ignored (PageRange).cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- ParsedDocument
The parsed document, holding the selected pages in document order.
Exceptions
- ArgumentException
pathis null or empty.- FileNotFoundException
No file exists at
path.- ObjectDisposedException
The parser has been disposed.
- OperationCanceledException
The parse was canceled.
Parse(Attachment, string, CancellationToken)
Parses the pages of document that pageRange selects.
public ParsedDocument Parse(Attachment document, string pageRange, CancellationToken cancellationToken = default)
Parameters
documentAttachmentThe document to parse. It stays with the caller.
pageRangestringThe pages to parse, 1-based:
"3","1-5","5-","1-3, 7, 10-12"; null, empty or"*"for every page. Pages outside the document are ignored (PageRange).cancellationTokenCancellationTokenCancels the parse between pages.
Returns
- ParsedDocument
The parsed document, holding the selected pages in document order.
Exceptions
- ArgumentNullException
documentis null.- ObjectDisposedException
The parser has been disposed.
- OperationCanceledException
The parse was canceled.