在C#中设置打印机纸张大小

时间:2024-02-29 14:29:26
using System.Drawing.Printing.PrintDocument

using System.Drawing.Printing.PrinterSettings.PaperSizeCollection

using System.Drawing.Printing.PaperSize

using System.Drawing.Printing.PageSettings

/////////需要以上引用

PrintDocument pd = new PrintDocument();
PaperSize p=null;
foreach(PaperSize ps in pd.PrinterSettings.PaperSizes)
{   if(ps.PaperName.Equals("A3"))
  p = ps;
}
pd.DefaultPageSettings.PaperSize = p;
pd.Print();

 

相关文章