Skip to main content

BarCode.ExportToPdf(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Exports the bar code image to the specified file path in PDF format.

Namespace: DevExpress.BarCodes

Assembly: DevExpress.Docs.v25.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public void ExportToPdf(
    string fileName
)

Parameters

Name Type Description
fileName String

The file name (including the full path) for the created PDF file.

Remarks

The following code snippet exports the barcode as a PDF file with the specified settings:

BarCode barCode = new BarCode();
barCode.Symbology = Symbology.QRCode;
barCode.RotationAngle = 0;
barCode.CodeBinaryData = Encoding.Default.GetBytes("https://www.devexpress.com/");
barCode.Options.QRCode.CompactionMode = QRCodeCompactionMode.Byte;
barCode.Options.QRCode.ErrorLevel = QRCodeErrorLevel.Q;
barCode.Options.QRCode.ShowCodeText = true;
barCode.DpiX = 72;
barCode.DpiY = 72;
barCode.Module = 2f;
using (FileStream pdfFileStream = new FileStream("Exported_Barcode.pdf", FileMode.Create))
{
    barCode.ExportToPdf(pdfFileStream);
}

To print the bar code, use the BarCode.Print or the BarCode.ShowPrintPreview method.

See Also