打印文档

PDFCreator和打印相关的属性和方法有:

方法/属性 说明
Print 打印文档
PrintJobName 指定打印任务名称

提示:如果生成的文档有中文,建议使用PDF/A格式,否则可能打印不出中文。

示例一

Dim pdc As New PDFCreator()
pdc.ConformanceLevel = Pdf.PdfAConformanceLevel.PdfA1b
'使用PdfA1b格式,须在添加所有内容之前设置。
Dim
rect As RectangleF = pdc.PageRectangle()
rect.Inflate( - 72, - 72)

Dim
fnt As New Font("微软雅黑", 12)
pdc.DrawString(
"Hello 狐表!", fnt, Brushes.Black, rect)
pdc.Print()
'打印文档

示例二

如果是共享打印机,或有连续的多个打印任务,可用PrintJobName区分之:

Dim pdc As New PDFCreator()
pdc.ConformanceLevel = Pdf.PdfAConformanceLevel.PdfA1b
'使用PdfA1b格式,须在添加所有内容之前设置。
Dim
rect As RectangleF = pdc.PageRectangle()
rect.Inflate( - 72, - 72)

Dim
fnt As New Font("微软雅黑", 12)
pdc.DrawString(
"Hello 狐表!", fnt, Brushes.Black, rect)
pdc.PrintJobName =
"张三在打印单据" '指定任务名
pdc.Print()
'打印文档

任务名会显示在打印队列窗口:


本页地址:http://www.foxtable.com/webhelp/topics/6130.htm