Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Barcode FormSource

As of Q1 2025 RadPdfProcessing provides support for adding Barcodes (1D and 2D) into a PDF document. This is possible through the static FormSource.FromBarcode and FormSource.From2DBarcode methods. They utilize the Symbology1DType and Symbology2DType enums that represent the different types of 1D and 2D barcode symbologies supported by the barcode model. These are the publicly available overloads:

Method Description
FormSource.FromBarcode(Symbology1DType symbology, string value) Creates a FormSource object from a 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 a 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 a one-dimensional (1D) barcode parameters with custom Width and Height while specifying whether the text should be shown or not (showText is false by default).
FormSource.FromBarcode(Symbology1DType symbology, string value, bool showText) Creates a FormSource object from a one-dimensional (1D) barcode parameters while specifying whether the text should be shown or not (showText is false by default). Width and Height are 100 by default.
FormSource.From2DBarcode(Symbology2DType symbology, string value) Creates a FormSource object from a 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 a 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 using the FixedContentEditor:

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);

PdfProcessing Insert Barcode

In this article