We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to Set Printing Preferences programmatically

Is it possible to set specific printing preferences such as orientation and paper size in the code behind rather than asking the user to select these items through the print dialog:
 
For example to accomplish setting the orientation and paper size, the user must follow these steps
1.  Click the "Advanced" button on the Syncfusion "Print Diagram" dialog
2.  Select a printer from the Windows "Print" dialog
3.  Click the "Preferences" button on the Windows "Print" dialog
4.  Choose the desired "Orientation" on the "Printing Preferences" dialog
5.  Choose the desired "Paper Size" on the "Printing Preferences" dialog
6.  Click "OK" on the "Printing Preferences" dialog
7.  Finally Click on "Print" on the Windows "Print" dialog
 
I'd like to be able to create my own print dialog, and set these preferences on a per user basis.
 
Please let me know if this is possible
 
Todd

1 Reply

SC Sudhakar C Syncfusion Team August 1, 2013 10:52 AM UTC

Hi Todd,

 

We have analyzed your query to print the diagram directly rather than through the print dialog box, we have created a sample for your reference. In that sample, there is a button named “Print”. Using this button, we can directly print the diagram without open the PrintDialogbox. For more information please refer the attached sample.

 

Note : In that sample we can manually set the page size also. Please refer the code snippet.

 

Code Snippet :

 

//Rectangle to contain the VisualBrush.

Rectangle rect = new Rectangle();

rect.Fill = VisualBrush;

 

// Here we have set the size of the Page as PageAreaSize. We can set whatever we needed.

rect.Arrange(new Rect(new Point(0, 0), pageAreaSize));

// For example : rect.Arrange(new Rect(new Point(0, 0), new Point(500,500)));

 

 

 

Please let us know if you have any concerns on this.

 

Regards,

 

Sudhakar C



CustomizeThePrinting_cb77a7e2.zip

Loader.
Live Chat Icon For mobile
Up arrow icon