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
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
- IReadOnlyList<BarcodePage>
One BarcodePage per page read, in page order.
Exceptions
- ArgumentNullException
sourceisnull.
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
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.
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
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
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
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.