'针式打印机的连进连出打印:
e.Form.Page.LeftMargin = 0 '设置左边距
e.Form.Page.RightMargin = 0 '设置右边距
e.Form.Page.TopMargin = 0 '设置上边距
e.Form.Page.BottomMargin = 0 '设置下边距
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
doc.PageSetting.Width = 218 '纸张宽度为218毫米
doc.PageSetting.Height = 94 '纸张高度为94毫米
doc.AutoRotate = False '如果纸张的宽度超过高度,要加上这行代码
Dim ndoc As new PrintDoc
Dim ra_1 As new prt.RenderArea
Dim ra_2 As new prt.RenderArea
Dim ra_3 As new prt.RenderArea
Dim flag As Boolean = False
For Each c As object In Doc.Body.Children
If c.Gettype.name Like "*RenderText*" Then
If flag = False Then
ra_1.Children.Add(c.Clone)
Dim nrt = c.clone
nrt.height = 0
ra_2.Children.Add(nrt)
Else
ra_2.Children.Add(c.clone)
End If
ElseIf c.Gettype.name Like "*RenderTable*" Then
ra_3.Children.Add(c.Clone)
Dim nrt = c.clone
nrt.height = 0
ra_2.Children.Add(nrt)
flag = True
End If
Next
ndoc.Body.Children.Add(ra_3)
nDoc.PageHeader = ra_1 '作为页眉使用
ndoc.PageFooter = ra_2
ndoc.PageSetting.LeftMargin = 0 '设置左边距
ndoc.PageSetting.RightMargin = 0 '设置右边距
ndoc.PageSetting.TopMargin = 0 '设置上边距
ndoc.PageSetting.BottomMargin = 0 '设置下边距
ndoc.PageSetting.Width = 218 '纸张宽度为218毫米
ndoc.PageSetting.Height = 94 '纸张高度为94毫米
ndoc.AutoRotate = False '如果纸张的宽度超过高度,要加上这行代码
ndoc.Preview()