A third party PDF component can do this for U ,after add reference ,here is the code:
//draw Codabar
PdfTextWidget text = new PdfTextWidget();
text.Font = font1;
text.Text = "Codabar:";
PdfLayoutResult result = text.Draw(page, 0, y);
page = result.Page;
y = result.Bounds.Bottom + 2;
PdfCodabarBarcode barcode1 = new PdfCodabarBarcode("00:12-3456/7890");
barcode1.BarcodeToTextGapHeight = 1f;
barcode1.EnableCheckDigit = true;
barcode1.ShowCheckDigit = true;
barcode1.TextDisplayLocation = TextLocation.Bottom;
barcode1.TextColor = Color.Green;
barcode1.Draw(page, new PointF(0, y));
y = barcode1.Bounds.Bottom + 5;
//draw Barcode
text.Text = "Code123:";
result = text.Draw(page, 0, y);
page = result.Page;
y = result.Bounds.Bottom + 2;
PdfCode11Barcode barcode2 = new PdfCode11Barcode("123-4567890");
barcode2.BarcodeToTextGapHeight = 1f;
barcode2.TextDisplayLocation = TextLocation.Bottom;
barcode2.TextColor = Color.OrangeRed;
barcode2.Draw(page, new PointF(0, y));
y = barcode2.Bounds.Bottom + 5;
You can set barcode format and some properties such as text display location, color etc.
No comments:
Post a Comment