ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Common Assembly / GrapeCity.ActiveReports Namespace / PrintExtension Class / Print Method / Print(PageDocument,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.
Example

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

    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.

    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, with an option to display the print dialog for user interaction. It defaults to showing the print progress dialog and 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 the print dialog displayed:
    var pageReport = new PageReport();
    PageDocument pageDocument = new PageDocument(pageReport);
    bool printSuccess = pageDocument.Print(showPrintDialog: true);
    if (printSuccess)
    	Console.WriteLine("Printing completed successfully.");
    else
    	Console.WriteLine("Printing failed.");
    See Also