就把标题和内容分开2段代码
Dim doc As New PrintDoc
Dim rt As New prt.RenderText
rt.Text = "我是标题"
doc.Body.Children.Add(rt)
doc.print() '预览
doc = New PrintDoc
rt= New prt.RenderText
rt.Text = "我是内容"
doc.Body.Children.Add(rt)
'设置页眉
rt = New prt.RenderText '设置文本对象的内容
rt.Text = "第[PageNo]页,共[PageCount]页" '设置文本内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right '靠右对齐
rt.Style.Borders.Bottom = New prt.LineDef(0.3, Color.Green) '设置底边框
rt.Style.Padding.Bottom = 0.5 '底端内容缩进0.5毫米
rt.Style.FontSize = 8 '字体大小为8磅
Doc.PageHeader = rt '作为页眉使用
doc.print() '预览