在条码打印中经常需要把条码打印到文档里的指定位置,Barcode Professional SDK for .NET条码控件可以帮助开发人员轻松实现该功能,打印指定大小和指定区域的条码,具体如下:
private void printDocumentObject_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//Create a Barcode Professional object
BarcodeProfessional bcp = new BarcodeProfessional();
//Barcode settings
bcp.Symbology = Symbology.Code39;
bcp.Code = "123456789";
//...
//Print the barcode at x=1in, y=1in using DrawOnCanvas method
bcp.DrawOnCanvas(e.Graphics, new PointF(1, 1));
}