Class PdfBarcodeReaderOptions
An Options class of PdfBarcodeReaderOptions for reading many popular barcode formats from PDFs.
Features: MaxParallelThreads, Reading detail, ExpectMultipleBarcodes, Crop-area, Image filters and preprocessing for improved accuracy.Inherited Members
Namespace: IronBarCode
Assembly: IronBarCode.dll
Syntax
public class PdfBarcodeReaderOptions : BarcodeReaderOptions
Page selection, rendering resolution, and password handling for reading barcodes out of a PDF live on PdfBarcodeReaderOptions. It is the argument a developer passes to BarcodeReader.ReadPdf, ReadPdfs, and ReadPdfsAsync to point the reader at the right pages of a document and to open a protected file. This is the type behind a search like "read barcode from PDF C#" or "scan barcode in PDF page", and it answers the questions a plain image read cannot.
PdfBarcodeReaderOptions derives from BarcodeReaderOptions, so it carries every base setting, the symbology, scan mode, speed, and image handling, and adds the PDF-only properties on top. A developer constructs one, sets the PDF-specific properties a job needs, and passes it to a ReadPdf overload that takes a path, byte array, or stream. Constructor overloads let a single page number or a sequence of page numbers be supplied up front.
The PDF-specific properties are few and purposeful. PageNumbers is an IEnumerable<int> that restricts the read to chosen pages instead of scanning the whole document, which matters for large files. DPI sets the resolution each page is rendered at before scanning, and Scale adjusts the rendered page size; raising either helps small or dense codes resolve at the cost of speed. Password opens an encrypted PDF so its pages can be rendered and read. Because the base properties still apply, a PDF read can also set ExpectBarcodeTypes, Speed, and the rest exactly as an image read would. Leave the PDF properties at their defaults to scan every page at the standard resolution.
using IronBarCode;
var options = new PdfBarcodeReaderOptions
{
PageNumbers = new[] { 1, 2 },
DPI = 150,
Password = "secret"
};
BarcodeResults results = BarcodeReader.ReadPdf("invoice.pdf", options);The read barcodes from PDF how-to walks through a document read, the PDF barcode reader settings example shows the configured options, and the reading barcodes tutorial covers the wider workflow.
Constructors
PdfBarcodeReaderOptions()
Initializes a new instance of the PdfBarcodeReaderOptions class.
Declaration
public PdfBarcodeReaderOptions()
PdfBarcodeReaderOptions(IEnumerable<Int32>)
Initializes a new instance of the PdfBarcodeReaderOptions class with the specified pages.
Declaration
public PdfBarcodeReaderOptions(IEnumerable<int> pageNumbers)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Int32> | pageNumbers | The page numbers of the PDF. |
PdfBarcodeReaderOptions(Int32)
Initializes a new instance of the PdfBarcodeReaderOptions class with the specified page.
Declaration
public PdfBarcodeReaderOptions(int pageNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pageNumber | The page number of the PDF. |
Properties
DPI
The Dots per inch to rendering each Barcode images.
Declaration
public int DPI { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
PageNumbers
The page numbers of the PDF to read expressed as an Array, List or IEnumerable of System.Int32. PageNumbers are '1 based' meaning that the first page number is 1 rather than zero.
Declaration
public IEnumerable<int> PageNumbers { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Int32> |
Password
The password string to open / unencrypt the PDF. Null or "" assign no password.
Declaration
public string Password { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Scale
The Scale Factor for Scaling Width and Height when convert Pdf to Image. Default 3.5.
Declaration
public double Scale { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |