Steps on how to insert and embed a Code 39 into PDF Page.

PDF Code 39 is a variable length, discrete barcode symbology, also known as Code 3/9, Code 3 of 9, USD-3 or USS Code 39. Code 39 barcode is commonly used in store items, inventories, badges and similar everyday items.

.NET Code 39 creator is one of the PDF barcode generation features in XsPDF barcode creator. In this tutorial, developers can make and encode code39 and insert the barcode drawing to PDF page using C# code 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 code 3 of 9 symbol
barcode.BarType = BarCodeType.Code39;

// Set barcode date to encode
barcode.Data = "123456789";

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

// Set 1d barcode human-readable text to display
barcode.ShowText = true;
// Set the barcode Position and location
barcode.Location = new XPoint(100, 100);

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


// Save and show the document           

More PDF tutorial