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
sourceAttachmentThe document.
pageRangestringThe pages to read, 1-based ("1-5, 8");
null, empty or "*" reads them all.dpiintThe resolution a PDF or other vector page is rendered at; image pages are read at their own resolution.
cancellationTokenCancellationTokenCancels the read between pages.
Returns
- Task<IReadOnlyList<BarcodePage>>
One BarcodePage per page read, in page order.
Exceptions
- ArgumentNullException
sourceisnull.
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
inputPathstringThe document file.
pageRangestringThe pages to read, 1-based;
nullreads them all.dpiintThe resolution vector pages are rendered at.
passwordstringThe password of an encrypted PDF.
cancellationTokenCancellationTokenCancels the read between pages.
Returns
Exceptions
- ArgumentNullException
inputPathisnull.- 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
databyte[]The document's bytes.
fileNamestringThe document's name; its extension tells its type.
pageRangestringThe pages to read, 1-based;
nullreads them all.dpiintThe resolution vector pages are rendered at.
passwordstringThe password of an encrypted PDF.
cancellationTokenCancellationTokenCancels the read between pages.
Returns
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
streamStreamThe document's stream; a stream that cannot seek is copied once.
fileNamestringThe document's name; its extension tells its type.
pageRangestringThe pages to read, 1-based;
nullreads them all.dpiintThe resolution vector pages are rendered at.
passwordstringThe password of an encrypted PDF.
cancellationTokenCancellationTokenCancels the read between pages.