ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer Class / Print Method / Print(Boolean,Boolean,Boolean) Method
If this property is set to True, then a dialog in which the user can set the printer options beforethe document contents are sent to the printer, is displayed.
If this property is set to True, then a print progress dialog, in which the user can cancel the printing job, is displayed.
Specifies whether printing should be performed for individual threads or not.
Example

In This Topic
    Print(Boolean,Boolean,Boolean) Method
    In This Topic
    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.
    Syntax
    'Declaration
     
    Public Overloads Function Print( _
       ByVal showPrintDialog As Boolean, _
       ByVal showPrintProgressDialog As Boolean, _
       ByVal usePrintingThread As Boolean _
    ) As Boolean

    Parameters

    showPrintDialog
    If this property is set to True, then a dialog in which the user can set the printer options beforethe document contents are sent to the printer, is displayed.
    showPrintProgressDialog
    If this property is set to True, then a print progress dialog, in which the user can cancel the printing job, is displayed.
    usePrintingThread
    Specifies whether printing should be performed for individual threads or not.

    Return Value

    Returns true if the printing process is successfully initiated; otherwise, returns false. Note that a return value of true indicates successful initiation of the print job but does not guarantee its completion.
    Exceptions
    ExceptionDescription
    Thrown if the method is called while the document is not in a completed load state.
    Remarks
    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.
    Example
    // 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.");
    See Also