现在有个条码打印需求,参照例子做了个实例。
要达到的效果:
此主题相关图片如下:22.png

实例代码:
Dim value As String = e.Form.Controls("start").value
Dim n As Integer = e.Form.Controls("No").value
Dim strN As Integer = Cint(Value.Replace("2121030928DAE5",""))
Dim str As String
Dim i As Integer
For i = 0 To StrN + n -2
str = "2121030928DAE5" & Format(strN + i,"000000")
Dim doc As New PrintDoc
Doc.PageSetting.Landscape = False
Doc.PageSetting.LeftMargin = 1
Doc.PageSetting.TopMargin = 2.5
Doc.PageSetting.BottomMargin = 2
Doc.PageSetting.RightMargin = 1
Doc.PageSetting.Width = 60
Doc.PageSetting.Height = 15
Dim bar As new BarCodeBuilder
Dim img As new prt.RenderImage
bar.Symbology = Barpro.Symbology.Code128
bar.DisplayCode = True
bar.Code = str
bar.Text = "B" & " " & Date.Today()
Bar.CodeAlignment = Barpro.Alignment.BelowLeft
Bar.TextAlignment = Barpro.Alignment.BelowRight
img.Image = bar.GetImage
Doc.Body.Children.Add(img)
Doc.Print()
Next
测试预览效果还满好样,打印结果就不行了,如图:
此主题相关图片如下:11.png

请教下,怎样能调整到能达到预期效果呢。