Scan QR Code

GroupDocs.Parser .Net allows to scan QR Code from PDF, MS Word (DOC, DOCX), MS PowerPoint (PPT, PPTX), LibreOffice formats and many others (see full list at supported document formats article).

GroupDocs.Parser’s QR Code scanner is easy to use and powerful at the same time. Our sophisticated algorithms allow to read even damaged barcodes.

This article demonstrates how to implement QR Code reader from any supported format.

How to scan QR Code in .Net with GroupDocs.Parser

To scan QR Code 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 QR Code from file:

  • Instantiate Parser object for the initial file;
  • Check if the file supports barcodes extraction;
  • Call GetBarcodes method and obtain collection of PageBarcodeArea objects;
  • Iterate through the collection and get a barcode value.

The following example shows how to scan barcode:

// 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 with type "QR" from your file.
    IEnumerable<PageBarcodeArea> qrcodes = parser.GetBarcodes().Where(i => i.CodeTypeName == "QR");

    // Iterate over barcodes
    foreach (PageBarcodeArea qrcode in qrcodes)
    {
        // Print the page index
        Console.WriteLine("Page: " + qrcode.Page.Index.ToString());
        // Print the qrcode value
        Console.WriteLine("Value: " + qrcode.Value);
    }
}

More resources

Advanced usage topics

To learn more about scan barcode features, please refer the advanced usage section.

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online text extractor App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to scan QR Code from your file with our free online GroupDocs Scanner App which is build with GroupDocs.Parser .Net.