在打印作业期间更换打印机纸盘

Sam*_*Sam 3 .net c# printing .net-4.0

有没有办法在打印作业期间切换打印机托盘?我被要求整理一个提货/装箱单程序。他们希望库存提货单打印在一张彩色纸上,装箱单打印在白纸上,并且他们希望对其进行正确校对(提货、包装、包装、包装、包装;提货、包装、包装、包装、盒; ...)。

我发现了一些关于设置默认托盘的其他线程,但在工作过程中没有在交替托盘上找到任何内容。也许我没有在寻找正确的东西。

不知道这是否有区别,但我们的打印机是 HP 3015n,客户端将是 XP 和 Win 7 Pro。

Met*_*Man 5

您可以尝试这样的操作,您必须System.Drawing.dll从项目中引用 --> 参考 --> 添加

//Namespace:  System.Drawing.Printing
//Assembly:  System.Drawing (in System.Drawing.dll)

PrintDocument printDoc = new PrintDocument();
PaperSize oPS = new PaperSize();
oPS.RawKind = (int)PaperKind.A4;
PaperSource oPSource = new PaperSource();
oPSource.RawKind = (int) PaperSourceKind.Upper;

printDoc.PrinterSettings = new PrinterSettings();
printDoc.PrinterSettings.PrinterName = sPrinterName;
printDoc.DefaultPageSettings.PaperSize = oPS;
printDoc.DefaultPageSettings.PaperSource = oPSource;
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
printDoc.Print();
printDoc.Dispose();
Run Code Online (Sandbox Code Playgroud)

  • 抱歉,我无法使用这种方法在同一作业中更换托盘。我在 printDoc_PrintPage 中更改托盘。它似乎忽略了这一变化......有没有机会全面实施? (2认同)