且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用vb.net设置打印机属性

更新时间:2023-10-19 22:04:04

在检查了库之后,您要做的就是使用SetActivePrinter方法更改默认打印机,如下所示:

After Checking the library all you have to do is using SetActivePrinter Method to change your default printer like the following:

 AxEDOffice1.SetActivePrinter("Adobe PDF")

要更改PaperSize,您必须使用以下内容

And to change PaperSize you have to use the following

AxEDOffice1.ActiveDocument.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4

AxEDOffice1.ActiveDocumentMicrosoft.Office.Interop.Word.WordDocumentClass

代码对其进行了测试,并且效果很好.

Code tested it and it works fine.

对象变量或未设置带块变量

Object variable or With block variable not set

在此 MSDN文章有很多建议.

要直接打印文档而不显示PrintDialog,必须使用PrintOut功能.

To Print your document directly without showing PrintDialog you have to use PrintOut Function.

AxEDOffice1.PrintOut(EDOfficeLib.WdPrintOutRange.wdPrintAllDocument)