BarCode.Print() Method
In This Article
Prints the barcode to the default printer.
Namespace: DevExpress.BarCodes
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
#Declaration
#Remarks
Use the BarCode.PrintDialog method to invoke a dialog that allows you to select a printer and specify the printer settings.
Call the BarCode.ShowPrintPreview method to preview the printout.
The example below shows how to create and print a QR code.
// Add a reference to the DevExpress.Printing.Core.dll assembly.
using DevExpress.BarCodes;
//...
BarCode barCode = new BarCode();
barCode.Symbology = Symbology.QRCode;
barCode.CodeText = "https://www.devexpress.com/";
barCode.BackColor = Color.White;
barCode.ForeColor = Color.Black;
barCode.RotationAngle = 0;
barCode.CodeBinaryData = Encoding.Default.GetBytes(barCode.CodeText);
barCode.Options.QRCode.CompactionMode = QRCodeCompactionMode.Byte;
barCode.Options.QRCode.ErrorLevel = QRCodeErrorLevel.Q;
barCode.Options.QRCode.ShowCodeText = false;
barCode.DpiX = 72;
barCode.DpiY = 72;
barCode.Module = 2f;
if (barCode.IsPrintingAvailable)
{
// Print the barcode.
barCode.Print();
}
To export a barcode to PDF, use the BarCode.ExportToPdf method overloads.
See Also