officefileapi-devexpress-dot-barcodes-dot-barcode-d3c4a240.md
Prints the barcode to the default printer.
Namespace : DevExpress.BarCodes
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void Print()
Public Sub Print
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();
}
' Add a reference to the DevExpress.Printing.Core.dll assembly.
Imports DevExpress.BarCodes
'...
Dim barCode As 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 Then
' Print the barcode.
barCode.Print()
End If
To export a barcode to PDF, use the BarCode.ExportToPdf method overloads.
See Also