Table of Contents

Method ReadPages

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

ReadPages(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 IReadOnlyList<BarcodePage> ReadPages(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

IReadOnlyList<BarcodePage>

One BarcodePage per page read, in page order.

Exceptions

ArgumentNullException

source is null.

ReadPages(string, string, int, string, CancellationToken)

Reads every barcode of the pages of a document file.

public IReadOnlyList<BarcodePage> ReadPages(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

IReadOnlyList<BarcodePage>

Exceptions

ArgumentNullException

inputPath is null.

FileNotFoundException

The file does not exist.

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

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

public IReadOnlyList<BarcodePage> ReadPages(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

IReadOnlyList<BarcodePage>

ReadPages(Stream, string, string, int, string, CancellationToken)

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

public IReadOnlyList<BarcodePage> ReadPages(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

IReadOnlyList<BarcodePage>
Share