Table of Contents

Method SplitToStreamsAsync

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

SplitToStreamsAsync(Attachment, Func<BarcodeSegment, Stream>, bool, CancellationToken)

Splits a batch into streams you open: openPart is asked for a writable stream for each document (its OutputName is already set), the document is written to it and the stream is flushed, then disposed unless leaveOpen.

public Task<BarcodeSplittingResult> SplitToStreamsAsync(Attachment source, Func<BarcodeSegment, Stream> openPart, bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

source Attachment

The batch.

openPart Func<BarcodeSegment, Stream>

Opens the stream a document is written to; returning null skips the document.

leaveOpen bool

Whether the streams are left open after writing. Default: false.

cancellationToken CancellationToken

Cancels the run between pages and documents.

Returns

Task<BarcodeSplittingResult>

Exceptions

ArgumentNullException

source or openPart is null.

SplitToStreamsAsync(string, Func<BarcodeSegment, Stream>, string, bool, CancellationToken)

Splits a batch file into streams you open.

public Task<BarcodeSplittingResult> SplitToStreamsAsync(string inputPath, Func<BarcodeSegment, Stream> openPart, string password = "", bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

inputPath string

The batch file.

openPart Func<BarcodeSegment, Stream>

Opens the stream a document is written to; returning null skips the document.

password string

The password of an encrypted PDF.

leaveOpen bool

Whether the streams are left open after writing.

cancellationToken CancellationToken

Cancels the run between pages and documents.

Returns

Task<BarcodeSplittingResult>

SplitToStreamsAsync(byte[], string, Func<BarcodeSegment, Stream>, string, bool, CancellationToken)

Splits a batch held in memory into streams you open.

public Task<BarcodeSplittingResult> SplitToStreamsAsync(byte[] data, string fileName, Func<BarcodeSegment, Stream> openPart, string password = "", bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

data byte[]

The batch's bytes.

fileName string

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

openPart Func<BarcodeSegment, Stream>

Opens the stream a document is written to; returning null skips the document.

password string

The password of an encrypted PDF.

leaveOpen bool

Whether the streams are left open after writing.

cancellationToken CancellationToken

Cancels the run between pages and documents.

Returns

Task<BarcodeSplittingResult>

SplitToStreamsAsync(Stream, string, Func<BarcodeSegment, Stream>, string, bool, CancellationToken)

Splits a batch read from a stream (left open) into streams you open.

public Task<BarcodeSplittingResult> SplitToStreamsAsync(Stream stream, string fileName, Func<BarcodeSegment, Stream> openPart, string password = "", bool leaveOpen = false, CancellationToken cancellationToken = default)

Parameters

stream Stream

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

fileName string

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

openPart Func<BarcodeSegment, Stream>

Opens the stream a document is written to; returning null skips the document.

password string

The password of an encrypted PDF.

leaveOpen bool

Whether the streams are left open after writing.

cancellationToken CancellationToken

Cancels the run between pages and documents.

Returns

Task<BarcodeSplittingResult>
Share