Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

public void Print()

#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