New to Telerik Document Processing? Start a free 30-day trial
Barcode FormSource
Updated on Jun 3, 2026
| Minimum Version | Q1 2025 |
|---|
RadPdfProcessing supports adding barcodes (1D and 2D) into a PDF document. The static FormSource.FromBarcode and FormSource.From2DBarcode methods use the Symbology1DType and Symbology2DType enums that represent the different types of 1D and 2D barcode symbologies supported by the barcode model. The following overloads are available:
| Method | Description |
|---|---|
FormSource.FromBarcode(Symbology1DType symbology, string value) | Creates a FormSource object from one-dimensional (1D) barcode parameters, with a default Width and Height of 100. |
FormSource.FromBarcode(Symbology1DType symbology, string value, int width, int height) | Creates a FormSource object from one-dimensional (1D) barcode parameters with custom Width and Height. |
FormSource.FromBarcode(Symbology1DType symbology, string value, int width, int height, bool showText) | Creates a FormSource object from one-dimensional (1D) barcode parameters with custom Width and Height while specifying whether to show the text (showText is false by default). |
FormSource.FromBarcode(Symbology1DType symbology, string value, bool showText) | Creates a FormSource object from one-dimensional (1D) barcode parameters while specifying whether to show the text (showText is false by default). Width and Height are 100 by default. |
FormSource.From2DBarcode(Symbology2DType symbology, string value) | Creates a FormSource object from two-dimensional (2D) barcode parameters, with a default Width and Height of 100. |
FormSource.From2DBarcode(Symbology2DType symbology, string value, int width, int height) | Creates a FormSource object from two-dimensional (2D) barcode parameters, with custom Width and Height. |
The following example shows how to create a barcode as a FormSource object and insert it in a page by using the FixedContentEditor:
C#
RadFixedDocument doc = new RadFixedDocument();
FixedContentEditor documentPageEditor = new FixedContentEditor(doc.Pages.AddPage());
documentPageEditor.Position.Translate(0, 0);
FormSource barcode = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", width: 100, height: 100);
documentPageEditor.DrawForm(barcode, 100, 100);
documentPageEditor.Position.Translate(120, 0);
FormSource barcodeWithCenterCenterText = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", showText: true);
documentPageEditor.DrawForm(barcodeWithCenterCenterText, 100, 100);
documentPageEditor.Position.Translate(240, 0);
FormSource swissQr = FormSource.From2DBarcode(Symbology2DType.SwissQR, "1234567890");
documentPageEditor.DrawForm(swissQr, 100, 100);
documentPageEditor.Position.Translate(360, 0);
FormSource qr = FormSource.From2DBarcode(Symbology2DType.QR, "1234567890");
documentPageEditor.DrawForm(qr, 100, 100);
