Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, November 22, 2021 12:15:16 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 360


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:
UriBarcodeScreenshot.png

This is the project ZIP file:
File Attachment(s):
OpenQrUri.zip (12kb) downloaded 1 time(s).
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2021, Yet Another Forum.NET
This page was generated in 0.062 seconds.