麻烦老师帮忙看一下 预览是正确的 打印机纸张变大之后 内容也跟着变大了
Dim r As Row =Tables("物料表").Current
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = "http://www.baidu.com"
Bar.QuietZoneWidth = 2
Bar.SaveImage(ProjectPath & "Reports\xsd" & r("物料代码") & ".jpg" )
Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 100 '纸张宽度为100毫米
doc.PageSetting.Height = 60 '纸张高度为120毫米
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rg.Style.Spacing.Top = 3
Dim rep As New prt.RenderEmpty '定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rep ) '加入到报表中
Dim rt As New prt.RenderTable() '定义一个表格对象
rt.Style.Font = New Font("微软雅黑",8) '设置文本对象的字体
rt.Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Style.TextAlignVert = prt.AlignHorzEnum.Center
rt.Style.Borders.All = New prt.Linedef(0.5, Color.black)
rt.Cols(0).Width =2
rt.Cols(4).Width =2
rt.Cols(6).Width =2
rt.Cols(1).Width =15
rt.Height =55
For i As Integer = 1 To 5
rt.Cells(0,i).Style.Borders.Bottom =New prt.Linedef(0.1, Color.Gray , DashStyle.Solid ) '设置底边框
Next
For i As Integer = 1 To 5
For J As Integer =1 To 3
rt.Cells(i,j).Style.Borders.Bottom =New prt.Linedef(0.1, Color.Gray , DashStyle.Solid ) '设置底边框
Next
Next
For i As Integer = 0 To 6
rt.Cells(i,2).Style.Font =New Font("微软雅黑", 8, FontStyle.Bold) '设置字体
Next
rt.Cells(0,4).Style.Font =New Font("微软雅黑", 8, FontStyle.Bold) '设置字体
rt.Cells(0,1).Text = "物料编码"
rt.Cells(0,2).Text =r("物料代码")
rt.Cells(0,3).Style.TextAlignHorz = prt.AlignHorzEnum.right
rt.Cells(0,3).Text =" 订单号"
rt.Cells(0,4).Text =""
rt.Cells(0,4).SpanCols =2
rt.Cells(1,1).Text = "物料名称"
rt.Cells(1,2).Text =r("物料名称")
rt.Cells(1,2).SpanCols =2
rt.Cells(2,1).Text = "物料尺寸"
rt.Cells(2,2).Text =r("规格型号")
rt.Cells(2,2).SpanCols =2
rt.Cells(2,5).Text = ProjectPath & "Reports\xsd" & r("物料代码") & ".jpg"
rt.Cells(2,5).SpanRows =4
rt.Cells(2,5).RenderObject =rg
rt.Cells(3,1).Text = "定制产品"
Dim dz As String
rt.Cells(3,2).Text =dz
rt.Cells(3,2).SpanCols =2
rt.Cells(4,1).Text = "包装说明"
rt.Cells(4,2).Text = ""
rt.Cells(4,2).SpanCols =2
rt.Cells(5,1).Text = "进仓编号"
rt.Cells(5,2).Text =""
rt.Cells(5,2).SpanCols =2
rt.Cells(6,1).Text = "常规效果"
rt.Cells(6,2).Text =r("效果")
rt.Cells(6,2).SpanCols =5
doc.Body.Children.Add(rt)
Doc.PageSetting.LeftMargin = 2 '设置左边距
Doc.PageSetting.RightMargin = 2 '设置右边距
Doc.PageSetting.TopMargin = 2 '设置上边距
Doc.PageSetting.BottomMargin =2 '设置下边距
Doc.Preview