Table of Contents

Method ReadPagesAsync

Namespace
LMKit.Extraction.Barcodes
Assembly
LM-Kit.NET.dll

ReadPagesAsync(Attachment, string, int, CancellationToken)

Reads every barcode of the pages of a document (PDF, image, multi-page TIFF...). Pages are decoded in parallel; a page that cannot be read is returned with its Error instead of stopping the others.

public Task<IReadOnlyList<BarcodePage>> ReadPagesAsync(Attachment source, string pageRange = null, int dpi = 200, CancellationToken cancellationToken = default)

Parameters

source Attachment

The document.

pageRange string

The pages to read, 1-based ("1-5, 8"); null, empty or "*" reads them all.

dpi int

The resolution a PDF or other vector page is rendered at; image pages are read at their own resolution.

cancellationToken CancellationToken

Cancels the read between pages.

Returns

Task<IReadOnlyList<BarcodePage>>

One BarcodePage per page read, in page order.

Exceptions

ArgumentNullException

source is null.

ReadPagesAsync(string, string, int, string, CancellationToken)

Reads every barcode of the pages of a document file.

public Task<IReadOnlyList<BarcodePage>> ReadPagesAsync(string inputPath, string pageRange = null, int dpi = 200, string password = "", CancellationToken cancellationToken = default)

Parameters

inputPath string

The document file.

pageRange string

The pages to read, 1-based; null reads them all.

dpi int

The resolution vector pages are rendered at.

password string

The password of an encrypted PDF.

cancellationToken CancellationToken

Cancels the read between pages.

Returns

Task<IReadOnlyList<BarcodePage>>

Exceptions

ArgumentNullException

inputPath is null.

FileNotFoundException

The file does not exist.

ReadPagesAsync(byte[], string, string, int, string, CancellationToken)

Reads every barcode of the pages of a document held in memory.

public Task<IReadOnlyList<BarcodePage>> ReadPagesAsync(byte[] data, string fileName, string pageRange = null, int dpi = 200, string password = "", CancellationToken cancellationToken = default)

Parameters

data byte[]

The document's bytes.

fileName string

The document's name; its extension tells its type.

pageRange string

The pages to read, 1-based; null reads them all.

dpi int

The resolution vector pages are rendered at.

password string

The password of an encrypted PDF.

cancellationToken CancellationToken

Cancels the read between pages.

Returns

Task<IReadOnlyList<BarcodePage>>

ReadPagesAsync(Stream, string, string, int, string, CancellationToken)

Reads every barcode of the pages of a document read from a stream (left open).

public Task<IReadOnlyList<BarcodePage>> ReadPagesAsync(Stream stream, string fileName, string pageRange = null, int dpi = 200, string password = "", CancellationToken cancellationToken = default)

Parameters

stream Stream

The document's stream; a stream that cannot seek is copied once.

fileName string

The document's name; its extension tells its type.

pageRange string

The pages to read, 1-based; null reads them all.

dpi int

The resolution vector pages are rendered at.

password string

The password of an encrypted PDF.

cancellationToken CancellationToken

Cancels the read between pages.

Returns

Task<IReadOnlyList<BarcodePage>>
Share