Dim doc As New PrintDoc
doc.PageSetting.Landscape = True
Doc.PageSetting.Width = 75
Doc.PageSetting.Height = 45
Doc.PageSetting.LeftMargin = 0
Doc.PageSetting.RightMargin = 0
Doc.PageSetting.TopMargin = 5
Doc.PageSetting.BottomMargin = 0
Dim ra As prt.RenderArea
Dim ra1 As prt.RenderArea
Dim ra2 As prt.RenderArea
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Dim rs As prt.RenderText
For Each dr As DataRow In dt.DataRows
ra = New prt.RenderArea
ra.Stacking = prt.StackingRulesEnum.BlockLeftToRight
rg = New prt.RenderGraphics
Bar = New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
bar.Code = "kwid_" & dr("kwid")
' Bar.QRCodeModuleSize = 0.5
rg = New prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics, 0, 0, 1)
ra.Children.Add(rg)
ra1 = New prt.RenderArea
ra1.Stacking = prt.StackingRulesEnum.BlockTopToBottom
rs = New prt.RenderText
rs.Text = dr("kwName")
rs.Style.F
rs.Style.F
rs.Style.FontBold = True
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
ra1.Children.Add(rs)
rs = New prt.RenderText
rs.Text = "仓库:" & dr("varGxNames")
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
ra1.Children.Add(rs)
rs = New prt.RenderText
Dim cc As String = ""
If dr("length") > 0 Then
cc = dr("length") & "M"
End If
If dr("width") > 0 Then
If cc > "" Then
cc = cc & " x "
End If
cc = cc & dr("width") & "M"
End If
If dr("high") > 0 Then
If cc > "" Then
cc = cc & " x "
End If
cc = cc & dr("high") & "M"
End If
rs.Text = "尺寸:" & cc
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
ra1.Children.Add(rs)
rs = New prt.RenderText
Dim tj As String = "体积:"
If dr("volume") > 0 Then
tj = tj & dr("volume") & "立方"
End If
rs.Text = tj
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
ra1.Children.Add(rs)
rs = New prt.RenderText
If dr("weight") > 0 Then
rs.Text = "承重:" & dr("weight") & "kg"
Else
rs.Text = "承重:"
End If
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
ra1.Children.Add(rs)
rs = New prt.RenderText
If dr("liftHigh") > 0 Then
rs.Text = "离地:" & dr("liftHigh") & "M"
Else
rs.Text = "离地:"
End If
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
ra1.Children.Add(rs)
ra.Children.Add(ra1)
doc.Body.Children.Add(ra)
rs = New prt.RenderText
rs.Text = "二维码时间:" & Format(Date.Now, "g")
rs.Style.Spacing.top = 3
rs.Style.Spacing.left = 20
rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
rs.Style.F
rs.Style.F
rs.Style.FontBold = False
rs.Style.FontItalic = False
rs.Style.FontUnderline = False
doc.Body.Children.Add(rs)
Next
e.WriteReportAsPDF(doc)