ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Common Assembly / GrapeCity.ActiveReports Namespace / PrintExtension Class / Print Method / Print(PageDocument,Boolean,Boolean) Method
The GrapeCity.ActiveReports.Document.PageDocument instance representing the document to be printed. This document contains the content and layout information for the print job.
A System.Boolean value indicating whether the print dialog should be shown to the user before printing. If set to true, the print dialog is displayed, allowing the user to modify printer settings such as the printer to use, the range of pages to print, and the number of copies. If set to false, the document is printed directly with the current printer settings.
A System.Boolean value indicating whether the print progress dialog should be shown during the printing process. If set to true, the progress dialog is displayed, providing feedback about the printing status to the user.
Example

In This Topic
    Print(PageDocument,Boolean,Boolean) Method
    In This Topic
    Initiates the printing process for a page-based document, with options to display the print dialog and the print progress dialog.
    Syntax
    'Declaration
     
    Public Overloads Shared Function Print( _
       ByVal pageDocument As PageDocument, _
       ByVal showPrintDialog As Boolean, _
       ByVal showPrintProgressDialog As Boolean _
    ) As Boolean
    public static bool Print( 
       PageDocument pageDocument,
       bool showPrintDialog,
       bool showPrintProgressDialog
    )

    Parameters

    pageDocument
    The GrapeCity.ActiveReports.Document.PageDocument instance representing the document to be printed. This document contains the content and layout information for the print job.
    showPrintDialog
    A System.Boolean value indicating whether the print dialog should be shown to the user before printing. If set to true, the print dialog is displayed, allowing the user to modify printer settings such as the printer to use, the range of pages to print, and the number of copies. If set to false, the document is printed directly with the current printer settings.
    showPrintProgressDialog
    A System.Boolean value indicating whether the print progress dialog should be shown during the printing process. If set to true, the progress dialog is displayed, providing feedback about the printing status to the user.

    Return Value

    A System.Boolean value indicating the success of the print operation. Returns true if the print operation completes successfully; otherwise, returns false. A return value of false may indicate that the user cancelled the print job or that an error occurred during the printing process.
    Remarks
    This method provides a simplified interface for printing page-based documents, offering control over the display of the print dialog and the print progress dialog. It defaults to executing the print job on a separate thread to maintain UI responsiveness. This method is part of the GrapeCity ActiveReports printing extensions and is designed to integrate seamlessly with ActiveReports reporting components.
    Example
    The following example demonstrates how to print a page document with both the print dialog and the print progress dialog displayed:
    var pageReport = new PageReport();
    PageDocument pageDocument = new PageDocument(pageReport);
    bool printSuccess = pageDocument.Print(showPrintDialog: true, showPrintProgressDialog: true);
    if (printSuccess)
    	Console.WriteLine("Printing completed successfully.");
    else
    	Console.WriteLine("Printing failed.");
    See Also