怎么按照我设定的缩放比例进行二维码图片列的打印呢?
当前代码如下:
If Tables("卷宗入库").Current IsNot Nothing Then
Dim CurRow As Row = Tables("卷宗入库").Current
Dim drs1 = DataTables("款物明细").Select("案件编号 = '" & currow("卷宗编号") & "'")
Dim doc As New PrintDoc
Dim rg As prt.RenderGraphics
Dim rm As New prt.RenderImage '定义一个图片对象
Dim dr As Row=Tables("打印机").Current
doc.PageSetting.Width = val(dr("设置宽度"))
doc.PageSetting.Height = val(dr("设置高度") )
doc.PageSetting.LeftMargin=val(dr("左边距") )
doc.PageSetting.RightMargin=val(dr("右边距") )
doc.PageSetting.TopMargin=val(dr("上边距") )
doc.PageSetting.BottomMargin=val(dr("下边距") )
Doc.PrinterName = dr("打印机名称")
doc.AutoRotate = dr("是否旋转")
doc.PageSetting.Landscape=dr("是否横向")
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For i As Integer = 0 To drs1.count-1
Dim r = drs1(i)
rm = new prt.RenderImage
rm.Width = "Parent.Width" '宽度等于页面宽度 ‘指定高度和宽度结果打印的图片都不如原来按照缩放比例进行打印的清晰和快速识别率’
rm.Height = "Auto" '高度由图片大小自动决定
rm.Image = GetImage( r("二维码")) '设置图片
rm.Style.ImageAlign.StretchHorz = True '禁止图片水平拉伸
rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '居中显示
rm.Style.ImageAlign.KeepAspectRatio=True
rm.Style.Borders.All = New prt.Linedef(1, Color.Red) '设置边框
doc.Body.Children.Add(rm) '将图片对象加入报
Next
Doc.Preview() '预览
End If
原来的部分代码如下:因为是代码直接生成了二维码 ,现在是改写了另外的方式,怎么实现按预先设定的缩放比例来进行打印呢?
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Dim dr As Row=Tables("打印机").Current
doc.PageSetting.Width = val(dr("设置宽度"))
doc.PageSetting.Height = val(dr("设置高度") )
doc.PageSetting.LeftMargin=val(dr("左边距") )
doc.PageSetting.RightMargin=val(dr("右边距") )
doc.PageSetting.TopMargin=val(dr("上边距") )
doc.PageSetting.BottomMargin=val(dr("下边距") )
Doc.PrinterName = dr("打印机名称")
'Dim xz As String = dr("是否旋转")
doc.AutoRotate = dr("是否旋转")
doc.PageSetting.Landscape=dr("是否横向")
Bar.Symbology = Barpro.Symbology.QRCode
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For Each r As Row In Tables("入库明细").Rows
bar.Text=r("分册编号") & "册"
bar.Code = r("加密字符")
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0, val(dr("缩放比例") ))
rg.Style.Spacing.All = 1
Doc.Body.Children.Add(rg)