PDF .NET Library Logo

How to draw 2D-Barcodes

The code sample below draws 2D barcodes on a PDF page

C# sample:

PDFDocument doc = new PDFDocument("barcode.pdf");

PDFTech.Barcodes.Barcode2D.DataMatrix dataMatrix = new PDFTech.Barcodes.Barcode2D.DataMatrix("123456789 PDFTech", UnitOfMeasure.Pixel);

dataMatrix.SymbolSize = PDFTech.Barcodes.DataMatrixSymbolSize.Size40X40;

if (dataMatrix.IsCodeValid())

{

      doc.CurrentPage.Body.Add2DBarcode(dataMatrix,130, 100);

}

if (!doc.Save())

      Console.WriteLine(doc.Error);    

Back to PDF Code Library