LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Use LEADTOOLS to Open a URI from a QR Code
#1
Posted
:
Monday, November 22, 2021 12:15:16 PM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
The attached C# project shows how to check a URI link embedded in a QR barcode and open it in the default browser.
The project is based on the
Detect and Extract Barcodes tutorial, with the following main modifications:
1. Instead of the following line:
Code:MessageBox.Show($"Symbology: {data.Symbology.ToString()}, Location: {data.Bounds.ToString()}, Data: {data.Value}");
The following code was added:
Code:
if (data.Symbology == BarcodeSymbology.QR)
ParseQR(data);
else
MessageBox.Show($"Symbology: {data.Symbology.ToString()}, Location: {data.Bounds.ToString()}, Data: {data.Value}");
2. The following function was added:
Code:
private void ParseQR(BarcodeData QRdata)
{
string QRString = QRdata.Value;
if (Uri.IsWellFormedUriString(QRString, UriKind.Absolute))
{
if (MessageBox.Show(QRString + "\nAppears to be a valid URI string. Would you like to try to open it in the default browser?", "LEADTOOLS demo", MessageBoxButtons.YesNo) == DialogResult.Yes)
System.Diagnostics.Process.Start(QRString);
}
else
MessageBox.Show(QRString + "\nDoes not appear to be a valid URI string.", "LEADTOOLS demo");
}
This is a screenshot of the program in action:
This is the project ZIP file:
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Use LEADTOOLS to Open a URI from a QR Code
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.