Created
October 21, 2022 15:44
-
-
Save conholdate-docs-gists/63ee67bbcee0453c7ff2c3dba12ac3a5 to your computer and use it in GitHub Desktop.
Scanning Barcode in C# | https://docs.conholdate.com/net/scanning-barcode/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of Parser class | |
using (Parser parser = new Parser(Constants.SamplePdfWithBarcodes)) | |
{ | |
// Check if the file supports barcodes extraction | |
if (!parser.Features.Barcodes) | |
{ | |
Console.WriteLine("The file doesn't support barcodes extraction."); | |
return; | |
} | |
// Scan barcodes from the file. | |
IEnumerable<PageBarcodeArea> barcodes = parser.GetBarcodes(); | |
// Iterate over barcodes | |
foreach (PageBarcodeArea barcode in barcodes) | |
{ | |
// Print the page index | |
Console.WriteLine("Page: " + barcode.Page.Index.ToString()); | |
// Print the barcode value | |
Console.WriteLine("Value: " + barcode.Value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read complete article here: https://docs.conholdate.com/net/scanning-barcode/