[SerializableAttribute()]
public enum QRBarcodeSymbolModel
Value | Member | Description |
---|---|---|
0 | Model2AutoSize |
QR Model 2 Auto size |
1 | Model2Version1 |
QR Model 2 Version 1 |
2 | Model2Version2 |
QR Model 2 Version 2 |
3 | Model2Version3 |
QR Model 2 Version 3 |
4 | Model2Version4 |
QR Model 2 Version 4 |
5 | Model2Version5 |
QR Model 2 Version 5 |
6 | Model2Version6 |
QR Model 2 Version 6 |
7 | Model2Version7 |
QR Model 2 Version 7 |
8 | Model2Version8 |
QR Model 2 Version 8 |
9 | Model2Version9 |
QR Model 2 Version 9 |
10 | Model2Version10 |
QR Model 2 Version 10 |
11 | Model2Version11 |
QR Model 2 Version 11 |
12 | Model2Version12 |
QR Model 2 Version 12 |
13 | Model2Version13 |
QR Model 2 Version 13 |
14 | Model2Version14 |
QR Model 2 Version 14 |
15 | Model2Version15 |
QR Model 2 Version 15 |
16 | Model2Version16 |
QR Model 2 Version 16 |
17 | Model2Version17 |
QR Model 2 Version 17 |
18 | Model2Version18 |
QR Model 2 Version 18 |
19 | Model2Version19 |
QR Model 2 Version 19 |
20 | Model2Version20 |
QR Model 2 Version 20 |
21 | Model2Version21 |
QR Model 2 Version 21 |
22 | Model2Version22 |
QR Model 2 Version 22 |
23 | Model2Version23 |
QR Model 2 Version 23 |
24 | Model2Version24 |
QR Model 2 Version 24 |
25 | Model2Version25 |
QR Model 2 Version 25 |
26 | Model2Version26 |
QR Model 2 Version 26 |
27 | Model2Version27 |
QR Model 2 Version 27 |
28 | Model2Version28 |
QR Model 2 Version 28 |
29 | Model2Version29 |
QR Model 2 Version 29 |
30 | Model2Version30 |
QR Model 2 Version 30 |
31 | Model2Version31 |
QR Model 2 Version 31 |
32 | Model2Version32 |
QR Model 2 Version 32 |
33 | Model2Version33 |
QR Model 2 Version 33 |
34 | Model2Version34 |
QR Model 2 Version 34 |
35 | Model2Version35 |
QR Model 2 Version 35 |
36 | Model2Version36 |
QR Model 2 Version 36 |
37 | Model2Version37 |
QR Model 2 Version 37 |
38 | Model2Version38 |
QR Model 2 Version 38 |
39 | Model2Version39 |
QR Model 2 Version 39 |
40 | Model2Version40 |
QR Model 2 Version 40 |
41 | Model1AutoSize |
QR Model 1 Auto size |
42 | Model1Version1 |
QR Model 1 Version 1 |
43 | Model1Version2 |
QR Model 1 Version 2 |
44 | Model1Version3 |
QR Model 1 Version 3 |
45 | Model1Version4 |
QR Model 1 Version 4 |
46 | Model1Version5 |
QR Model 1 Version 5 |
47 | Model1Version6 |
QR Model 1 Version 6 |
48 | Model1Version7 |
QR Model 1 Version 7 |
49 | Model1Version8 |
QR Model 1 Version 8 |
50 | Model1Version9 |
QR Model 1 Version 9 |
51 | Model1Version10 |
QR Model 1 Version 10 |
52 | Model1Version11 |
QR Model 1 Version 11 |
53 | Model1Version12 |
QR Model 1 Version 12 |
54 | Model1Version13 |
QR Model 1 Version 13 |
55 | Model1Version14 |
QR Model 1 Version 14 |
Used as the type for the QRBarcodeData.SymbolModel property to specify the QR barcode's symbol size.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;
public void QRBarcode_Example()
{
string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "MyQRBarcodes.tif");
BarcodeEngine engine = new BarcodeEngine();
// Create the image to write the barcodes to
int resolution = 300;
using (RasterImage image = RasterImage.Create((int)(8.5 * resolution), (int)(11.0 * resolution), 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White)))
{
// Write two QR barcodes
WriteBarcode(engine.Writer, image, QRBarcodeSymbolModel.Model1AutoSize, "QR Data 1", false);
WriteBarcode(engine.Writer, image, QRBarcodeSymbolModel.Model2Version30, "QR Data 2", true);
// Save the image
using (RasterCodecs codecs = new RasterCodecs())
{
codecs.Save(image, imageFileName, RasterImageFormat.CcittGroup4, 1);
}
}
// Now read the barcodes again
using (RasterCodecs codecs = new RasterCodecs())
{
using (RasterImage image = codecs.Load(imageFileName))
{
// Read all the QR barcodes
ReadBarcodes(engine.Reader, image);
}
}
}
private void WriteBarcode(BarcodeWriter writer, RasterImage image, QRBarcodeSymbolModel symbolModel, string value, bool topLeft)
{
// Create the barcode data
QRBarcodeData barcode = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData;
barcode.SymbolModel = symbolModel;
barcode.Value = value;
barcode.Symbology = BarcodeSymbology.QR;
// We will use the alignment to position the barcodes, so use all of the image
barcode.Bounds = new LeadRect(0, 0, image.ImageWidth, image.ImageHeight);
// Set the write options
QRBarcodeWriteOptions options = new QRBarcodeWriteOptions();
if (topLeft)
{
options.HorizontalAlignment = BarcodeAlignment.Near;
options.VerticalAlignment = BarcodeAlignment.Near;
}
else
{
options.HorizontalAlignment = BarcodeAlignment.Far;
options.VerticalAlignment = BarcodeAlignment.Far;
}
options.GroupNumber = 0;
options.GroupTotal = 0;
options.XModule = 30;
options.ECCLevel = QRBarcodeECCLevel.LevelL;
// Write it
Console.WriteLine("Writing barcode with symbol model: {0} and Data: {1}", symbolModel, value);
writer.WriteBarcode(image, barcode, options);
}
private void ReadBarcodes(BarcodeReader reader, RasterImage image)
{
// Setup read options
QRBarcodeReadOptions options = new QRBarcodeReadOptions();
options.EnableDoublePass = false;
options.EnableDoublePassIfSuccess = true;
options.EnablePreprocessing = true;
Console.WriteLine("Reading QR barcodes");
BarcodeData[] barcodes = reader.ReadBarcodes(image, LeadRect.Empty, 0, new BarcodeSymbology[] { BarcodeSymbology.QR }, new BarcodeReadOptions[] { options });
Console.WriteLine("{0} barcodes found:", barcodes.Length);
foreach (QRBarcodeData barcode in barcodes)
{
string value = BarcodeData.ParseECIData(barcode.GetData());
if (string.IsNullOrEmpty(value))
value = barcode.Value;
Console.WriteLine(" At {0}, symbol model: {1} data: {2} and symbology: {3}", barcode.Bounds, barcode.SymbolModel, value, barcode.Symbology);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}