Barcodes in .NET PDF Library

13 Aug 202624 minutes to read

Essential® PDF provides support to add barcodes to a PDF document. The following barcode types are supported:

  • One-dimensional barcodes, including Code 39 and Code 32.
  • Two-dimensional barcodes, such as QR Code, Data Matrix, and PDF417.

To quickly get started with QR codes in PDF documents using the Syncfusion® .NET PDF Library, watch this video:

Adding a one dimensional barcode to the PDF document

The below code example shows how to add Code39 barcode using the PdfCode39Barcode class to a PDF document.

using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Barcode;
using Syncfusion.Pdf.Graphics;

// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a new page to the PDF document
PdfPage page = document.Pages.Add();
// Create the Code 39 barcode
PdfCode39Barcode barcode = new PdfCode39Barcode();
// Set the height of the barcode
barcode.BarHeight = 45;
// Set the barcode text
barcode.Text = "CODE39$";
// Draw the barcode on the PDF page
barcode.Draw(page, new PointF(25, 70));
// Save the document
document.Save("CODE39.pdf");
// Close the document
document.Close(true);
using System.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Barcode;
using Syncfusion.Pdf.Graphics;

// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a new page to the PDF document
PdfPage page = document.Pages.Add();
// Create the Code 39 barcode
PdfCode39Barcode barcode =