Table of Contents

Method ParseAsync

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

ParseAsync(string, CancellationToken)

Asynchronously parses the document at path.

public Task<ParsedDocument> ParseAsync(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

Task<ParsedDocument>

A task whose result is the parsed document.

Exceptions

ArgumentException

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

document Attachment

The document to parse. It stays with the caller, who keeps it open until the task completes.

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

Task<ParsedDocument>

A task whose result is the parsed document.

Exceptions

ArgumentNullException

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

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 (Parse(string, string, CancellationToken)); null for every page.

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

Task<ParsedDocument>

A task whose result is the parsed document.

Exceptions

ArgumentException

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

document Attachment

The document to parse. It stays with the caller, who keeps it open until the task completes.

pageRange string

The pages to parse, 1-based (Parse(string, string, CancellationToken)); null for every page.

cancellationToken CancellationToken

Cancels the parse between pages.

Returns

Task<ParsedDocument>

A task whose result is the parsed document.

Exceptions

ArgumentNullException

document is null.

ObjectDisposedException

The parser has been disposed.

Share