Adding Barcodes to PDF in C#

Different types of Barcodes can be added to PDF easily using DynamicPDF Generator product. Different types of barcodes such as Code128, Data Matrix, PDF417 and QRCode can be created and added to a PDF document.

How to add barcodes to PDF in C#

Below are the steps and sample code to add different types of Barcodes to PDF document using the Generator product.

Steps for adding barcodes to PDF Document

  1. Create a Document object.
  2. Create and add a Page to the document.
  3. Create a Code128 barcode.
  4. Add the code128 barcode to the page.
  5. Create a DataMatrixBarcode barcode.
  6. Add the data matrix barcode to the Page.
  7. Create a Pdf417 barcode.
  8. Add the Pdf417 barcode to the page.
  9. Create a QRCode barcode.
  10. Add the qrcode barcode to the page.
  11. Save the PDF document.

Sample Code - C#

Document document = new Document();
Page page = new Page();
Code128 code128barCode = new Code128("Code 128 Barcode.", 100, 50, 48, 0.75F);
DataMatrixBarcode dataMatrixBarcode = new DataMatrixBarcode("DataMatrix barcode", 100, 120);
Pdf417 pdf417 = new Pdf417("Pdf417 barcode", 100.0f, 200.0f, 2, 2.0f);
QrCode qrCode = new QrCode("QR code sample.", 100, 300);

Getting Started

NuGet Package

DynamicPDF Generator is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite package includes Generator, Merger and ReportWriter.

Nuget Logo
NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

Example Project

An example project showing this functionality can be cloned or viewed from GitHub:

GitHub Logo
Clone or View Example Project on GitHub

DynamicPDF Generator Information

More information can be found here:

Available in Other Platforms

Generator Libraries are available for Java and COM/AxtiveX platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!