此主题相关图片如下:上为打印报表打印下为pdf.jpg
Dim ID111 As String = e.Form.Controls("A031ID1").text
Dim ID222 As String = e.Form.Controls("A031ID2").text
Dim fl As String = "c:\data\test.pdf"
Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 60 '纸张宽度为100毫米
doc.PageSetting.Height = 40 '纸张高度为120毫米
Dim art As New prt.RenderTable() '定义一个表格对象
Doc.PageSetting.LeftMargin = 2 '设置左边距
Doc.PageSetting.RightMargin = 2 '设置右边距
Doc.PageSetting.TopMargin = 2 '设置上边距
Doc.PageSetting.BottomMargin = 2 '设置下边距
art.Width = "Parent.Width" '对象宽度等于页面宽度
art.Height = "Parent.Height" '对象高度等于页面高度
doc.Body.Children.Add(art) '将表格对象加入到报表中
art.Rows.Count = 5 '设置行数
art.Cols.Count = 5 '设置列数
art.Rows(4).height = 5
art.Cells(0,0).SpanCols = 2
art.Cells(0,2).SpanCols = 3
art.Cells(1,1).SpanCols = 4
art.Cells(2,0).SpanCols = 5
art.Cells(3,0).SpanCols = 5
art.Cells(4,0).SpanCols = 4
art.cells(1,0).text = "型号:"
art.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
art.Cells(1,0).Style.TextAlignVert = prt.AlignHorzEnum.Center '水平居中
art.cells(4,0).text = "北京测试维修"
art.Cells(4,0).Style.Font = New Font("宋体", 8 , FontStyle.Bold) '设置文本对象的字体
art.cells(1,1).text = e.Form.Controls("A031PM").text
art.cells(0,2).text = e.Form.Controls("A031ItemNo").text
art.Cells(0,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
art.Cells(0,2).Style.TextAlignVert = prt.AlignHorzEnum.Center '水平居中
Dim BarID1 As New BarCodeBuilder
BarID1.Symbology = Barpro.Symbology.Code128
BarID1.Code = ID111
BarID1.QuietZoneWidth = 3
BarID1.SaveImage("c:\ID111.bmp",1200)
Dim BarID2 As New BarCodeBuilder
BarID2.Symbology = Barpro.Symbology.Code128
BarID2.Code = ID222
BarID2.QuietZoneWidth = 3
BarID2.SaveImage("c:\ID222.bmp",1200)
Dim rm1 As New prt.RenderImage() '定义一个图片对象
rm1.Image = GetImage("c:\ID111.bmp") '请改为实际的图标名称和路径
rm1.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm1.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center '图片垂直居中
rm1.Style.ImageAlign.StretchHorz = False '禁止水平方向扩展图片
rm1.Style.ImageAlign.StretchVert = False '禁止垂直方向扩展图片
art.Cells(2,0).RenderObject = rm1 '将单元格内容设置为图片对象rm
Dim rm2 As New prt.RenderImage() '定义一个图片对象
rm2.Image = GetImage("c:\ID222.bmp") '请改为实际的图标名称和路径
rm2.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm2.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center '图片垂直居中
rm2.Style.ImageAlign.StretchHorz = False '禁止水平方向扩展图片
rm2.Style.ImageAlign.StretchVert = False '禁止垂直方向扩展图片
'doc.Body.Children.Add(art) '将表格对象加入到报表中
art.Cells(3,0).RenderObject = rm2 '将单元格内容设置为图片对象rm
Dim rm3 As New prt.RenderImage() '定义一个图片对象
rm3.Image = GetImage("2233__EXGX.jpg") '请改为实际的图标名称和路径
rm3.Width = 20'宽度等于页面宽度
rm3.Height = "Auto" '高度由图片大小自动决定
rm3.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm3.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center '图片垂直居中
rm3.Style.ImageAlign.StretchHorz = True '禁止水平方向扩展图片
rm3.Style.ImageAlign.StretchVert = True '禁止垂直方向扩展图片
art.Cells(0,0).RenderObject = rm3 '将单元格内容设置为图片对象rm
doc.AutoRotate = True
doc.PageSetting.Landscape = True
'doc.Print()
doc.SavePDF(fl) '保存为PDF文件