Created
October 21, 2022 16:02
-
-
Save conholdate-docs-gists/28590d7ad4bf27705a682483810228b5 to your computer and use it in GitHub Desktop.
Scan QR Code in C# | https://docs.conholdate.com/net/scanning-qr-code/
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 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); | |
} | |
} |
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-qr-code/