Articles in this section
Category / Section

How to enable the Print Properties option in the Print dialog in WPF Diagram (SfDiagram)?

2 mins read

In the WPF Diagram, you can enable the Print Properties option in the Print dialog using the rundll32 command to open the printer properties dialog for the selected printer. First, obtain the full name of the selected printer from the PrintOptionsControl. Then, configure a ProcessStartInfo to run cmd.exe with the appropriate arguments to launch the printer properties dialog. The code executes this command to allow access to and modification of the printer’s settings. We have provided the code example for how to achieve this.

private void Button_Click(object sender, RoutedEventArgs e)
       {
           PrintOptionsControl ctrl = (sender as Hyperlink).DataContext as PrintOptionsControl;

           string printerName = ctrl.SelectedPrinter.PrintQueue.FullName;
           System.Diagnostics.Process process = new System.Diagnostics.Process();
           System.Diagnostics.ProcessStartInfo startInfo = new
           System.Diagnostics.ProcessStartInfo();
           startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
           startInfo.FileName = "cmd.exe";
           startInfo.Arguments = "/C rundll32 printui.dll,PrintUIEntry /e /n \"" + printerName + "\"";
           process.StartInfo = startInfo;
           process.Start();
       } 

image.png

Conclusion
I hope you enjoyed learning about how to enable the Print Properties option in the Print dialog in WPF Diagram
You can refer to our WPF Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied