Dim doc As New PrintDoc() '定义一个报表
Dim ra As New prt.RenderArea '定义一个容器
ra.Width = 80 '宽度等于容器宽度
ra.Height = 15
ra.Style.Borders.All = New prt.Linedef(1, Color.Red) '设置边框
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.AddCheckSum = False
bar.Code = "123456"
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rg.Width = "Parent.Width" '宽度等于页面宽度
rg.Height = "Auto" '高度由图片大小自动决定
rg.Style.ImageAlign.StretchHorz = False '禁止图片水平拉伸
rg.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center
ra.Children.Add(rg) '将文本对象加入到报表
doc.Body.Children.Add(ra) '将容器ra加入到报表
doc.Preview() '预览