internal void PrintProof()
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
// 获取默认打印机设置
PrinterData oldPD = new PrinterData();
Printing.CustomprinterSettings.PrinterSettings ps = new Printing.CustomprinterSettings.PrinterSettings();
ps.ChangePrinterSetting(ref oldPD, false);
// 打印机设置Copy副本
PrinterData newPD = new PrinterData();
newPD = oldPD;
// 设置新参数
Printing.Proof pftest = (Proof)getPf();
float height = pftest.nowPosY.Value;
newPD.pmFields |= (int)DmFields.DM_DUPLEX | (int)DmFields.DM_ORIENTATION
| (int)DmFields.DM_DEFAULTSOURCE | (int)DmFields.DM_PAPERSIZE
| (int)DmFields.DM_PAPERLENGTH | (int)DmFields.DM_PAPERWIDTH;
newPD.Size = Printing.CustomprinterSettings.PaperSize.DMPAPER_USER;
newPD.pLength = (int) (height * 100 / 25.4) + common.Uitls.readPrintBlank();
//newPD.pWidth = 1200;
bool x = ps.ChangePrinterSetting(ref newPD, true);
//PrintControl(pd);
//PrintPreviewDialog pdialog = new PrintPreviewDialog();
//pdialog.Document = pd;
//pdialog.ShowDialog();
pd.Print();
// 还原设置
bool y = ps.ChangePrinterSetting(ref oldPD, true);
}