printdialog

Setting PageOrientation for the Wpf DocumentViewer PrintDialog

和自甴很熟 提交于 2019-11-27 12:20:02
问题 Using the Wpf DocumentViewer control I can't figure out how to set the PageOrientation on the PrintDialog that the DocumentViewer displays when the user clicks the print button. Is there a way to hook into this? 回答1: Mike's answer works. The way I chose to implement it was to instead create my own doc viewer derived from DocumentViewer. Also, casting the Document property to FixedDocument wasn't working for me - casting to FixedDocumentSequence was. GetDesiredPageOrientation is whatever you

Show Print Dialog before printing

徘徊边缘 提交于 2019-11-27 03:31:17
问题 I want to show the print dialog box before printing the document, so the user can choose another printer before printing. The code for printing is: private void button1_Click(object sender, EventArgs e) { try { PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintImage); pd.Print(); } catch (Exception ex) { MessageBox.Show(ex.Message, ToString()); } } void PrintImage(object o, PrintPageEventArgs e) { int x = SystemInformation.WorkingArea.X; int y =