Orientation and Paper on Print Setup dialog

frankborty 41 Reputation points
2022-06-20T14:18:54.513+00:00

Working to a WPF Application (.NET fw 4.5), I can't find a way to display a print setup dialog as in the following image (I think it's based on Windows Forms but a WPF solution it would be better):

213043-image.png

Using the code:

PrintDialog myPrintDialog = new PrintDialog();  
myPrintDialog.ShowDialog();  

I obtain a dialog with Print Range and Copies Settings (which I don't need) but not Paper and Orientation (which I want to get).

I read the question wpfcsharp-print-dialog-settings but I can't figure out how to use the accepted answer.

Developer technologies | Windows Forms
Developer technologies | Windows Presentation Foundation
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Castorix31 91,506 Reputation points
    2022-06-20T14:55:21.22+00:00

    You can get it, but it is the old Dialog Box, replaced by PageSetupDialog as MSDN says at : print-dialog-box
    For the PageSetupDialog, you can do for example :

                System.Windows.Forms.PageSetupDialog PageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();  
                PageSetupDialog1.PageSettings = new System.Drawing.Printing.PageSettings();  
                PageSetupDialog1.PrinterSettings = new System.Drawing.Printing.PrinterSettings();  
                PageSetupDialog1.AllowOrientation = true;  
                PageSetupDialog1.AllowPaper = true;  
                PageSetupDialog1.AllowPrinter = true;  
                DialogResult result = PageSetupDialog1.ShowDialog();  
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.