Table of Contents

Method Parse

Namespace
LMKit.Document.Parsing
Assembly
LM-Kit.NET.dll

Parse(string, CancellationToken)

Parses the document at path.

public ParsedDocument Parse(string path, CancellationToken cancellationToken = default)

Parameters

path string

Path of the document to parse: a PDF, an image, or any format Attachment opens.

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

ParsedDocument

The parsed document.

Exceptions

ArgumentException

path is 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

document Attachment

The document to parse. It stays with the caller.

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

ParsedDocument

The parsed document.

Exceptions

ArgumentNullException

document is 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

path string

Path of the document to parse: a PDF, an image, or any format Attachment opens.

pageRange string

The 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).

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

ParsedDocument

The parsed document, holding the selected pages in document order.

Exceptions

ArgumentException

path is 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

document Attachment

The document to parse. It stays with the caller.

pageRange string

The 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).

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

ParsedDocument

The parsed document, holding the selected pages in document order.

Exceptions

ArgumentNullException

document is null.

ObjectDisposedException

The parser has been disposed.

OperationCanceledException

The parse was canceled.

Share