如何在C#windows应用程序中设置打印机设置 [英] How to set printer setting prgrammically in C# windows application
问题描述
我的问题是,我必须在点阵打印机上打印发票复印件(8.5 * 11英寸)和交货(一半尺寸的一半)(8.5 * 6英寸)
。我想在同一个点阵打印机上打印。如何为报告提供打印机设置。
i我正在使用c#窗口应用程序。
我尝试过:
System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
pg.Margins.Top = 1;
pg.Margins.Bottom = 1;
pg.Margins.Left = 1;
pg.Margins.Right = 1 ;
System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();
size.PaperName =Custom;
reportViewer1.SetPageSettings(pg);
my problem was, i have to print invoice copy(8.5*11 inch) and delivery(half of a4 size )(8.5 * 6 inch)
in dot matrix printer. I want to print both in same dot matrix printer. how to give printer setting fro both report .
i am using c# window application.
What I have tried:
System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
pg.Margins.Top = 1;
pg.Margins.Bottom = 1;
pg.Margins.Left = 1;
pg.Margins.Right = 1;
System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();
size.PaperName = "Custom";
reportViewer1.SetPageSettings(pg);
推荐答案
您的PaperSize尺寸
未连接到PageSettings页面
。将一个附加到另一个。
YourPaperSize size
is not connected toPageSettings pg
. Attach one to the other.
size.PaperName = "Custom";
pg.PaperSize = size;
reportViewer1.SetPageSettings(pg);
浏览以下链接。
点击此处
这篇关于如何在C#windows应用程序中设置打印机设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!