Set PDF Barcode Reader Options

IronBarcode has a variety of options in the PdfBarcodeReaderOptions class to support customized and optimized reads for PDFs specifically. This will handle PDF passwords, choose which pages to scan, the DPI to parse the PDF in, and any additional scaling needed to improve the read quality.

Key Points

  1. Creating PdfBarcodeReaderOptions:
    • An instance of PdfBarcodeReaderOptions is created to set various options for PDF processing:
      • Dpi: Sets the resolution for PDF parsing. Higher DPI can improve barcode detection accuracy.
      • PageNumbers: Specifies the PDF pages that should be scanned. This can be customized to target specific pages.
      • Password: If the PDF is password-protected, the correct password can be provided using this option.
      • ScaleToX and ScaleToY: These options allow adjusting the scale of the PDF image to help in enhancing the barcode detection accuracy.
  2. Reading Barcodes:
    • The ReadPdfBarcodes method is used to read and decode barcodes from the PDF file. It utilizes the options specified.
  3. Iterating and Displaying Results:
    • A foreach loop iterates over the barcode results, displaying each barcode's type and value on the console.
    • This ensures that all detected barcodes from the specified pages are outputted for verification or further processing.

Discover How to Effortlessly Read Barcodes from PDFs Using C# and IronBarcode!