Skip to main content
A newer version of this page is available.
.NET Framework 4.5.2+
  • The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.

BarCode.Save(String, ImageFormat) Method

Saves the barcode image to a file in the specified format.

Namespace: DevExpress.BarCodes

Assembly: DevExpress.Docs.v19.1.dll

Declaration

public void Save(
    string fileName,
    ImageFormat format
)

Parameters

Name Type Description
fileName String

Specifies the file name to which to save the image.

format ImageFormat

An ImageFormat enumeration member that specifies the image format.

Remarks

Use the Save method overloads to export a barcode to an image file. Static properties of the ImageFormat class allow you to specify an output image format. To save a barcode as a vector image, pass the ImageFormat.Emf parameter to the method.

The example below shows how to create a QR code and save it as an image.

using DevExpress.BarCodes;
//...

BarCode barCode = new BarCode();
barCode.Symbology = Symbology.QRCode;
barCode.CodeText = "http://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;

barCode.Save("BarCodeImage.png", System.Drawing.Imaging.ImageFormat.Png);
See Also