[]
Initiates the printing process for the currently opened document, either a section or a page report, with the option to display or bypass the print dialog.
public bool Print(bool showPrintDialog)
Type | Name | Description |
---|---|---|
bool | showPrintDialog | Specifies whether to display the print dialog before printing.
Setting this to |
Type | Description |
---|---|
bool | Returns |
This overload of the Print
method uses default settings for showing the print progress dialog and using a printing thread.
To customize these settings, consider using the overload that accepts these parameters explicitly.
// Assuming 'viewer' is an instance of the Viewer class
// This will print to the default printer without showing the print dialog
bool printSuccess = viewer.Print(showPrintDialog: false);
if (printSuccess)
MessageBox.Show("Printing initiated successfully.");
else
MessageBox.Show("Printing failed.");
Initiates the printing process for the currently opened document, allowing for the display of the print dialog and the print progress dialog based on the provided parameters.
public bool Print(bool showPrintDialog, bool showPrintProgressDialog)
Type | Name | Description |
---|---|---|
bool | showPrintDialog | If set to |
bool | showPrintProgressDialog | If set to |
Type | Description |
---|---|
bool | Returns |
This method offers flexibility in the printing process by allowing the user to choose whether to display the print dialog and the print progress dialog. It is useful for scenarios where either direct printing with default settings is desired or user intervention is required to select specific printer settings.
// Assuming 'viewer' is an instance of the Viewer class
// This will print the document silently without showing the print dialog or the print progress dialog
bool printSuccess = viewer.Print(showPrintDialog: false, showPrintProgressDialog: false);
if (printSuccess)
MessageBox.Show("Printing initiated successfully.");
else
MessageBox.Show("Printing failed.");
Initiates the printing process for the currently opened document, with options to display the print dialog, the print progress dialog, and to use a separate printing thread.
public bool Print(bool showPrintDialog, bool showPrintProgressDialog, bool usePrintingThread)
Type | Name | Description |
---|---|---|
bool | showPrintDialog | If set to |
bool | showPrintProgressDialog | If set to |
bool | usePrintingThread | If set to |
Type | Description |
---|---|
bool | Returns |
This method provides comprehensive control over the printing process, including whether to display dialogs and whether to use a separate printing thread. It is designed to accommodate various printing scenarios, from direct printing with default settings to interactive printing with user-selected settings.
// Assuming 'viewer' is an instance of the Viewer class
// This will show both the print dialog and the print progress dialog to the user, and print on the UI thread
bool printSuccess = viewer.Print(showPrintDialog: true, showPrintProgressDialog: true, usePrintingThread: false);
if (printSuccess)
MessageBox.Show("Printing initiated successfully.");
else
MessageBox.Show("Printing failed.");
Type | Condition |
---|---|
InvalidOperationException | Thrown if the method is called while the document is not in a completed load state. |
Initiates the printing process for the currently opened document, using the specified printing settings.
public bool Print(PrintingSettings settings)
Type | Name | Description |
---|---|---|
PrintingSettings | settings | The printing settings to be used for this print job. This includes options for showing the print dialog, the print progress dialog, and whether to use a separate printing thread. |
Type | Description |
---|---|
bool | Returns |
This method allows for a flexible printing process by utilizing a PrintingSettings object to specify the desired printing behavior. It is designed to accommodate various printing scenarios, from direct printing with default settings to interactive printing with user-selected settings.
// Assuming 'viewer' is an instance of the Viewer class
// Configure printing to show print dialog, print progress dialog, and use a separate printing thread
viewer.Print(PrintingSettings.ShowPrintDialog | PrintingSettings.ShowPrintProgressDialog | PrintingSettings.UsePrintingThread);
Type | Condition |
---|---|
InvalidOperationException | Thrown if the method is called while the document is not in a completed load state, indicating that the document is not ready for printing. |