1.判断是在打印还是打印预览
private void PrintDocument1_BeginPrint(object sender, PrintEventArgs e) {//打印前 if (e.PrintAction == PrintAction.PrintToPrinter) {//打印 ; } else if (e.PrintAction == PrintAction.PrintToPreview) {//打印预缆 ; } }
2.获取打印机设置的纸张
foreach (PaperSize PS in PrintDocument1.PrinterSettings.PaperSizes) { if (PS.PaperName == "A4") { PrintDocument1.DefaultPageSettings.PaperSize = PS; } }