IRONSOFTWAREHOME
Add Barcodes in HTML to PDF
using IronPdf;
using IronPdf.Editing;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.WaitFor.RenderDelay(500);

// Load barcode via HTML
var barcodeHtml = @"<link href=""https://fonts.googleapis.com/css?family=Libre%20Barcode%20128""rel = ""stylesheet"" ><p style = ""font-family: 'Libre Barcode 128', serif; font-size:30px;""> Hello Google Fonts</p>";
var doc = renderer.RenderHtmlAsPdf(barcodeHtml);

// or use the BarcodeStamper
var barcodeStamp = new BarcodeStamper("Hello World", BarcodeEncoding.Code39);
doc.ApplyStamp(barcodeStamp);

// Export to a file or Stream
doc.SaveAs("bc-test.pdf");
Imports IronPdf
Imports IronPdf.Editing

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.WaitFor.RenderDelay(500)

' Load barcode via HTML
Dim barcodeHtml = "<link href=""https://fonts.googleapis.com/css?family=Libre%20Barcode%20128""rel = ""stylesheet"" ><p style = ""font-family: 'Libre Barcode 128', serif; font-size:30px;""> Hello Google Fonts</p>"
Dim doc = renderer.RenderHtmlAsPdf(barcodeHtml)

' or use the BarcodeStamper
Dim barcodeStamp = New BarcodeStamper("Hello World", BarcodeEncoding.Code39)
doc.ApplyStamp(barcodeStamp)

' Export to a file or Stream
doc.SaveAs("bc-test.pdf")
NuGet Download
PM > Install-Package IronPdf
Add Barcodes in HTML to PDF

Add Barcodes in HTML to PDF

Beyond providing extensive support for custom fonts such as Google fonts, IronPDF also supports stamping barcodes onto your PDF documents. This allows developers to include barcode information in your rendered PDFs with ease.

Steps to Generate a PDF with a Barcode Using IronPDF

First, ensure the IronPdf library is installed and imported into your project. Then, an instance of the ChromePdfRenderer class is initialized, which allows you to render HTML content into high-quality PDF documents.

Next, you need to create your barcode content. In our case, we have created an HTML string that incorporates a Google Fonts link for the "Libre Barcode 128" font. Then, use the RenderHtmlAsPdf method to turn the HTML content into a new PDF document.

Following the HTML rendering, a barcode stamp is created with the text "Hello World" and the Code39 encoding format. This stamp is then applied to the PDF document using the ApplyStamp method.

Finally, the generated PDF is saved to a file named "bc-test.pdf" using the SaveAs method. This straightforward process enables you to produce a PDF with both styled text and barcode content efficiently in your C# applications. It should be noted that in some cases, this functionality won't support your barcode type, such as with QR Codes. In these instances, an efficient solution would be to use IronBarcode to generate this barcode or QR Code and then add it to your PDF as an image.

Learn to Add Images to PDFs with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 21,105,021Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999