Steps on how to insert a Data Matrix Barcode into PDF Page.

Data Matrix is a 2D matrix barcode, modules arranged in either a square or rectangular pattern. It's most used in marking small items.

.NET PDF Datamatrix encoder supports to make 2D-array of booleans representing Data Matrix barcode image to PDF document. The created DataMatrix symbology is GS1 compatible, and can be scanned by any standard barcode reader. Developer can customize the barcode size, color, location in the PDF.

C# PDF Datamatrix generator can help programmer make and insert 2D barcode images to PDF page. This onine demo code will show how to render barcode in your PDF document easily.

// Create a new PDF document.
PdfDocument document = new PdfDocument();

// Create a page.
PdfPage page = document.AddPage();

// Get graphics object from pdf page
XGraphics g = XGraphics.FromPdfPage(page);

// Create a pdf barcode object
PdfBarcode barcode = new PdfBarcode();

// Set the barcode type to data matrix symbol
barcode.BarType = BarCodeType.DataMatrix;

// Input the barcode data content
barcode.Data = "xspdf123456789";

// Change foreground and background color of barcode
barcode.BarcodeColor = XColors.Black;
barcode.BackgroundColor = XColors.White;

//Set datamatrix shape mode: rectangle or square
barcode.DataMatrixShape = SymbolShapeMode.Square;

// Set the barcode Position and location
barcode.Location = new XPoint(100, 100);

// Set the barcode width and height
barcode.Size = new XSize(200, 200);

// Save and show the document           

More PDF tutorial