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
sourceAttachmentThe batch.
openPartFunc<BarcodeSegment, Stream>Opens the stream a document is written to; returning
nullskips the document.leaveOpenboolWhether the streams are left open after writing. Default:
false.cancellationTokenCancellationTokenCancels the run between pages and documents.
Returns
Exceptions
- ArgumentNullException
sourceoropenPartisnull.
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
inputPathstringThe batch file.
openPartFunc<BarcodeSegment, Stream>Opens the stream a document is written to; returning
nullskips the document.passwordstringThe password of an encrypted PDF.
leaveOpenboolWhether the streams are left open after writing.
cancellationTokenCancellationTokenCancels the run between pages and documents.
Returns
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
databyte[]The batch's bytes.
fileNamestringThe batch's name; its extension tells its type.
openPartFunc<BarcodeSegment, Stream>Opens the stream a document is written to; returning
nullskips the document.passwordstringThe password of an encrypted PDF.
leaveOpenboolWhether the streams are left open after writing.
cancellationTokenCancellationTokenCancels the run between pages and documents.
Returns
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
streamStreamThe batch's stream; a stream that cannot seek is copied once.
fileNamestringThe batch's name; its extension tells its type.
openPartFunc<BarcodeSegment, Stream>Opens the stream a document is written to; returning
nullskips the document.passwordstringThe password of an encrypted PDF.
leaveOpenboolWhether the streams are left open after writing.
cancellationTokenCancellationTokenCancels the run between pages and documents.