简体   繁体   English

打印到vb.net中用户选择的纸盘

[英]print to user selected tray in vb.net

I need to print the word document into user selected tray of the printer. 我需要将Word文档打印到打印机的用户选择的纸盘中。

I am working on VSTO and developing the new ribbon in ms Word 2010 which includes the printing option as-well. 我正在使用VSTO并在ms Word 2010中开发新的功能区,其中还包括打印选项。 I have managed to read the available trays for the selected printer and also user can select the specific tray. 我设法读取了所选打印机的可用纸盘,并且用户也可以选择特定的纸盘。

But the point where I am confused is when I am printing, how should I specify that selected tray? 但是,我感到困惑的是打印时,如何指定所选的纸盘?

I am working on vb.net. 我正在vb.net上工作。

You may use the PrinterSettings.PaperSources collection to iterate and determine which tray to use. 您可以使用PrinterSettings.PaperSources集合来迭代并确定要使用的纸盘。

http://msdn.microsoft.com/us-en/library/system.drawing.printing.printdocument.aspx http://msdn.microsoft.com/us-zh/library/system.drawing.printing.printdocument.aspx

http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.papersources http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.papersources

And to iterate, you can use this snippet as basis and expand as necessary: 要进行迭代,您可以使用此代码段作为基础并根据需要进行扩展:

PrintDocument printDoc1 = new PrintDocument();
for (int i = 0; i < printDoc1.PrinterSettings.PaperSources.Count; i++)
{
}

And to select a specific tray to use, set the PageSettings.PaperSource property. 并选择要使用的特定纸盒,请设置PageSettings.PaperSource属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM