Guide for C#
Core Document Formats
Additional Features
QR Code

C# Imaging - Read 2D QR Code in C#.NET

Sample C# Code to Decode QR Code from Document Image

Visual C#
Home > .NET Imaging SDK > C# > Read QR Code on Doc Image
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

C# Imaging - QR Code Reading Control
C#.NET BarcodeRead Add-on from RasterEdge DocImage SDK for .NET is a reliable, accurate & fast barcode detecting and reading control, designed specifically for .NET class applications (including ASP.NET web service and Windows application). This barcode decoding control can read QR Code barcode from scanned image files (including tiff, png, jpeg, png and bmp) and common documents (including PDF, MS Word, Excel & PowerPoint).
Besides, its ability to scan QR Code from a full page or certain specified region using C# code makes it extremely easy for users to optimize the barcode reading rate based on different applications.
QR Code, short for Quick Response Code, has become one of the most commonly used 2D barcode types in the world based on its huge information storage, high-level error correction level and square barcode pattern.
As QR Code has a wide valid data scope, thus, people often encode a website link into QR Code. Then one can easily visit this website by just scanning the QR code barcode, instead of entering the url in the web browser. Therefore, QR Code has been widely used in the marketing and advertising field as a promotion tool.
This QR Code detecting and reading tutorial for C#.NET document imaging application is divided into three parts:
  • C# imaging - QR Code reading & detecting from image file using C#.NET
  • C# imaging - QR Code reading & decoding from PDF document using C#.NET
  • C# imaging - QR Code scanning & detecting from Word document using C#.NET
  • C# imaging - QR Code detecting and decoding from Excel document
  • C# imaging - QR Code scanning and reading from PPTX document slide
C#.NET QR Code Reader Control Features
  • Mature QR Code barcode reading library for C#.NET imaging project with reasonable licensing
  • Compatible with .NET Framework 2.0 & above, suitable for Visual Studio 2005 & greater
  • Detect and read all QR Code barcodes from documents and image files using C#.NET
  • Extract and return recognized QR Code barcode value into data string using C# code
  • Read & decode QR Code barcode at any orientation from document image in C#.NET
  • Allow users to specify an area on the document or image to recognize QR Code barcode
If you want to know more detailed information on barcode reading & recognition from PDF document using C#.NET, please follow the link to read step-to-step tutorial and sample C# code.
Read QR Code from Scanned Image File Using C#
Using this barcode reader control, you can easily detect and decode all the QR Code barcodes from scanned image files using C# code. Its supported image file formats are tiff, png, jpeg, bmp and gif. The sample C# code below can help you detect all the QR Code barcodes from a tiff image file and returns the decoding values to data string.
public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName = FolderName + "SampleBarcode.tif";

string[] datas = BarcodeScanner.Scan(fileName, BarcodeType.QRCode);

foreach (string data in datas)
{
Debug.WriteLine(data);
}
}
Read QR Code from PDF File Using C# Code
This C#.NET barcode scanning control can also detect all the QR Code barcodes automatically from scanned PDF document file. Besides, by default, the barcode reader and scanner will detect all the QR Code barcodes from the whole PDF page with five algorithms.
public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName = FolderName + "Sample.pdf";

REImage reImage = (REImage)REFile.OpenDocumentFile(fileName, new PDFDecoder()).GetPage(0).ToImage();

string[] datas = BarcodeScanner.Scan(reImage, BarcodeType.QRCode);

foreach (string data in datas)
{
Debug.WriteLine(data);
}
}
Recognize QR Code from Word Document Using C#
This barcode reader control also supports detecting & recognizing QR Code from Word document in C#.NET class application. The QR Code barcode reader scanning area can be accurately specified using C# code. There is no fixed outputting ways to export the QR Code scanning results. Here, we output the decoding result to data string using C# code.
public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName = FolderName + "Sample.docx";

REImage reImage = (REImage)REFile.OpenDocumentFile(fileName, new DOCXDecoder()).GetPage(0).ToImage();

string[] datas = BarcodeScanner.Scan(reImage, BarcodeType.QRCode);

foreach (string data in datas)
{
Debug.WriteLine(data);
}
}
Scan QR Code on a Certain Excel Page in C#.NET
Apart from MS Word document, users also are supposed to use RasterEdge .NET Imaging Barcode Reading control to decode QR Code on a certain Excel document page with folloiwng C# sample code.
/// <summary>
/// Scan QR Code barcode on Excel Page
/// </summary>
/// <param name="page"></param>
/// <param name="barcodeType"></param>
/// <returns></returns>
public List ScanPage(ExcelPage page, RasterEdge.Imaging.Barcode.Scanner.BarcodeType barcodeType)
{

return page.ReadBarcode(barcodeType,0,1);

}
Recognize QR Code from PPTX Document in C#.NET
Users can detect and scan QR Code barcode from MS PowerPoint slide/page in high performance by combining RasterEdge .NET Imaging Barcode Reader and MS PPTX Document dll. Please see following demo code in C# class for detailed guide.
/// <summary>
/// Decode QR Code barcode on PPTX page
/// </summary>
public static void ReadBarcodeFromPPT()
{

PPTXDocument doc = new PPTXDocument(@"c:\test.pptx");
// Decode the QR Code data for the first page

REPage repage = (REPage)doc.GetPage(0);

REImage reImage = (REImage)repage.ToImage();

string[] data = BarcodeScanner.Scan(reImage, RasterEdge.Imaging.Barcode.Scanner.BarcodeType.QRCode);

}

public static void ReadBarcodeFromPPTInSpecificArea()
{

PPTXDocument doc = new PPTXDocument(@"c:\test.pptx");
// Read the QR Code data for the first page

REPage repage = (REPage)doc.GetPage(0);

REImage reImage = (REImage)repage.ToImage();

Setting set = new Setting();
set.Code39IncFindPtp = false;

List<SRegion> areas = new List<SRegion>();
PointF topLeftPoint = new PointF(0, 0);
PointF bottomRightPoint = new PointF(100, 100);
SRegion area = new SRegion(topLeftPoint, bottomRightPoint);
areas.Add(area);

set.setScanRegions(areas);

string[] data = BarcodeScanner.ScanRegions(reImage, RasterEdge.Imaging.Barcode.Scanner.BarcodeType.QRCode, set);

}


Recommend this to Google+