GroupDocs.Parser .Net allows to scan barcode from PDF, Microsoft Office formats: Word (DOC, DOCX), PowerPoint (PPT, PPTX), LibreOffice formats and many others (see full list at supported document formats article).
GroupDocs.Parser’s barcode scanner is easy to use and powerful at the same time. Our experience allowed us to implement sophisticated algorithms, which allows to read even damaged barcodes.
This article demonstrates how to implement the simplest scenario - read barcode from any supported format without additional settings (to resolve complex scenarios see advanced usage section.
How to scan barcode in .Net with GroupDocs.Parser
To scan barcode from your file, simply call GetBarcodes method:
IEnumerable<PageBarcodeArea>GetBarcodes();
This method returns a collection of PageBarcodeArea objects.
Here are the steps to extract a barcode from file:
Iterate through the collection and get a barcode value.
The following example shows how to scan barcode:
// Create an instance of Parser classusing(Parserparser=newParser(Constants.SamplePdfWithBarcodes)){// Check if the file supports barcodes extractionif(!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 barcodesforeach(PageBarcodeAreabarcodeinbarcodes){// Print the page indexConsole.WriteLine("Page: "+barcode.Page.Index.ToString());// Print the barcode valueConsole.WriteLine("Value: "+barcode.Value);}}
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to scan barcode from your files or mobile phone camera with our free online GroupDocs Scanner App which is build with GroupDocs.Parser .Net.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.