QRCodeGenerator.Logo Property
Specifies the image that overlays the QR code.
Namespace: DevExpress.XtraPrinting.BarCode
Assembly: DevExpress.Printing.v22.2.Core.dll
NuGet Packages: DevExpress.Printing.Core, DevExpress.Win.Dashboard.Design
Declaration
Property Value
Type | Default | Description |
---|---|---|
ImageSource | null | The image to be displayed on the QR code. |
Remarks
Use this property to specify an image for a QR code. For example, guidelines on Swiss bill reports demand that a QR code has a Swiss cross logo. The Create a Swiss QR Bill topic explains how to set up a QR code for a Swiss QR-bill report.
You can assign images of the following formats: BMP, JPG, JPEG, GIF, TIF, TIFF, PNG, ICO, DIB, RLE, JPE, JFIF, EMF, WMF, SVG.
Note
The Logo property is ignored when the AutoModule property is enabled.
If the Logo property is specified, the QRCodeGenerator.ErrorCorrectionLevel enumeration values are halved. The code below demonstrates how to set this property to an SVG image in code:
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateQRCode(string BarCodeText) {
// Create a bar code control.
XRBarCode barCode = new XRBarCode();
// Set the bar code's type to QRCode.
barCode.Symbology = new QRCodeGenerator();
barCode.ShowText = false;
barCode.Width = 470;
barCode.Height = 470;
barCode.Module = 4.07F;
// Adjust the properties specific to the bar code type.
((QRCodeGenerator)barCode.Symbology).CompactionMode = QRCodeCompactionMode.Byte;
((QRCodeGenerator)barCode.Symbology).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.M;
((QRCodeGenerator)barCode.Symbology).Version = QRCodeVersion.Version24;
((QRCodeGenerator)barCode.Symbology).Logo = ImageSource.FromFile(@"..\..\CH-Kreuz_7mm.svg");
return barCode;
}