Class BarcodeStamper
Stamps barcodes and QR codes onto PDF pages for tracking, URLs, and data encoding. Supports Code128, Code39, and QR Code formats with customizable dimensions.
Example - Add barcodes to PDFs:
var pdf = PdfDocument.FromFile("invoice.pdf");
// QR code for payment URL (top-right corner):
var paymentQR = new BarcodeStamper(
"https://pay.example.com/inv-12345",
BarcodeEncoding.QRCode)
{
Width = 100,
Height = 100,
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
VerticalOffset = new Length(20, MeasurementUnit.Pixel)
};
pdf.ApplyStamp(paymentQR);
// Product barcode (bottom of page):
var productCode = new BarcodeStamper(
"SKU-2024-0012345",
BarcodeEncoding.Code128)
{
Width = 200,
Height = 50,
VerticalAlignment = VerticalAlignment.Bottom
};
pdf.ApplyStamp(productCode);
pdf.SaveAs("invoice_with_barcodes.pdf");
Inherited Members
Namespace: IronPdf.Editing
Assembly: IronPdf.dll
Syntax
public class BarcodeStamper : Stamper
Use BarcodeStamper in IronPDF when a C# application works with PDF editing. It represents stamps barcodes and QR codes onto PDF pages for tracking, URLs, and data encoding.
BarcodeStamper matters when an application needs to configure or invoke PDF editing from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use BarcodeStamper, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key properties include BarcodeType, Height, Value, Width. Assign options or invoke methods on the instance to configure or perform the operation. The add copy delete pages PDF covers typical usage in C# end to end.
using IronPdf;
// Obtain BarcodeStamper from the relevant entry point in the IronPDF API
void Configure(BarcodeStamper instance)
{
var current = instance.BarcodeType;
}For the broader workflow, see the add images to pdfs guide in the IronPDF C# documentation. For broader context, the PDF editing portion of the IronPDF C# API contains related types that work with BarcodeStamper directly. BarcodeStamper instances inherit additional members from Stamper that may be relevant in advanced scenarios. In application code, treat BarcodeStamper as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant BarcodeStamper property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of BarcodeStamper.
Constructors
BarcodeStamper(String, BarcodeEncoding)
Initializes a new instance of the BarcodeStamper class.
Width and Height are 250px each by default unless explicitly set.
Declaration
public BarcodeStamper(string Value, BarcodeEncoding BarcodeType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | Value | The value of the barcode as a string. |
| BarcodeEncoding | BarcodeType | Barcode encoding type to use for this Stamper. Supported encoding types include: QRCode, Code128, and Code39. BarcodeEncoding. |
BarcodeStamper(String, BarcodeEncoding, Int32, Int32)
Initializes a new instance of the BarcodeStamper class.
Declaration
public BarcodeStamper(string Value, BarcodeEncoding BarcodeType, int Width, int Height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | Value | The value of the barcode as a string. |
| BarcodeEncoding | BarcodeType | Barcode encoding type to use for this Stamper. Supported encoding types include: QRCode, Code128, and Code39. BarcodeEncoding. |
| System.Int32 | Width | The width of the rendered barcode in pixels. |
| System.Int32 | Height | The height of the rendered barcode in pixels. |
Properties
BarcodeType
Barcode encoding type to use for this Stamper. Supported encoding types include: QRCode, Code128, and Code39. Please see: BarcodeEncoding.
Default is QRCode
Declaration
public BarcodeEncoding BarcodeType { get; set; }
Property Value
| Type | Description |
|---|---|
| BarcodeEncoding |
Height
The height of the rendered barcode in pixels. Default is 250px
Declaration
public int Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Value
The value of the barcode as a string.
Declaration
public string Value { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Width
The width of the rendered barcode in pixels. Default is 250px
Declaration
public int Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |