A custom PrintDialog for WPF with preview in realtime. Full options with printer settings, include copies, custom pages, orientation, color, quality, scale, pages-per-sheet, double-sided, paper size, paper type, paper source, etc. Support realtime updates to the content according to the changes in settings. Fast and elegant user interface.
PrintDialogX is a powerful and beautiful customized print dialog. It basically supports all functions with the default Windows print dialog, but also provides extra functions and realtime previews. The printer settings only use the given printer's allowed options. The document being printed is also flexible and available for changes in content according to the adjusted settings by the user. The show-while-generate-document feature also allows a fast and user-friendly experience, where the document is generated dynamically while the print dialog is preparing itself.
- Printer list
- Printer icons & status
- "Add New Printer" button
- Tooltip on printer options for detailed information
- Printer settings
- Copies and collate
- Pages (all, current, or custom)
- Orientation
- Color and quality
- Pages per sheet and page order
- Scale and margin
- Doubled-sided and flipping
- Paper size, type, and source
- Interactable realtime preview
- Zooming and text selection
- Page position and navigation
- Updatable document
- Document reloading callback for specfic printer settings
- Realtime update on the content
- Result callback
- Whether the "Print" button is clicked or the "Cancel" button
- The number of papers used
- Beautiful user interface
- Uses Wpf.Ui
- .Net Framework >= 4.8
- Wpf.Ui = 3.0.0
The example project is included in the PrintDialogX.Test subfolder, with both examples of the show-while-generate-document feature, where the document is generated while the print dialog is showing, and the old method of generating the document beforehand and showing the print dialog after.
Show-while-generate-document feature, where GeneratingDocument
is the function callback used to generate the document:
//Initialize a PrintDialog and set its properties
PrintDialogX.PrintDialog.PrintDialog printDialog = new PrintDialogX.PrintDialog.PrintDialog()
{
Owner = this, //Set PrintDialog's owner
Title = "Test Print", //Set PrintDialog's title
Icon = null, //Set PrintDialog's icon (null means use the default icon)
Topmost = false, //Don't allow PrintDialog to be at topmost
ShowInTaskbar = true,//Don't allow PrintDialog to show in taskbar
ResizeMode = ResizeMode.NoResize, //Don't allow PrintDialog to resize
WindowStartupLocation = WindowStartupLocation.CenterOwner //PrintDialog's startup location is the center of the owner
};
//Show PrintDialog and begin to generate document
if (printDialog.ShowDialog(true, GeneratingDocument) == true)
{
//When the Print button is clicked, the document is printed, and the window is closed
MessageBox.Show("Document printed.\nIt uses " + printDialog.TotalPapers + " sheet(s) of paper.", "PrintDialog", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
else
{
//When the Cancel button is clicked and the window is closed
MessageBox.Show("Print job canceled.", "PrintDialog", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
Default settings of the print dialog can be set as well:
printDialog.DefaultSettings = new PrintDialogX.PrintDialog.PrintDialogSettings() //Set default settings
{
Layout = PrintDialogX.PrintSettings.PageOrientation.Portrait,
Color = PrintDialogX.PrintSettings.PageColor.Color,
Quality = PrintDialogX.PrintSettings.PageQuality.Normal,
PageSize = PrintDialogX.PrintSettings.PageSize.ISOA4,
PageType = PrintDialogX.PrintSettings.PageType.Plain,
DoubleSided = PrintDialogX.PrintSettings.DoubleSided.DoubleSidedLongEdge,
PagesPerSheet = 1,
PageOrder = PrintDialogX.PrintSettings.PageOrder.Horizontal
};
//Or you can just use PrintDialog.PrintDialogSettings.PrinterDefaultSettings() to get a PrintDialogSettings that uses the printer's default settings
//printDialog.DefaultSettings = PrintDialog.PrintDialogSettings.PrinterDefaultSettings()
This project is under the MIT License.