您可以尝试这样的操作,您必须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)
| 归档时间: |
|
| 查看次数: |
10317 次 |
| 最近记录: |