ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Common Assembly / GrapeCity.ActiveReports Namespace / PrintExtension Class / Print Method / Print(PageDocument,PrinterSettings) 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.
An instance of PrinterSettings that specifies the settings to be used for the print job, including whether to show the print dialog, the print progress dialog, whether to use a printing thread, and details about the printer configuration.
Example

In This Topic
    Print(PageDocument,PrinterSettings) Method
    In This Topic
    Initiates the printing process for a page-based document using specified printer settings.
    Syntax
    'Declaration
     
    Public Overloads Shared Function Print( _
       ByVal pageDocument As PageDocument, _
       ByVal printerSettings As PrinterSettings _
    ) As Boolean
    public static bool Print( 
       PageDocument pageDocument,
       PrinterSettings printerSettings
    )

    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.
    printerSettings
    An instance of PrinterSettings that specifies the settings to be used for the print job, including whether to show the print dialog, the print progress dialog, whether to use a printing thread, and details about the printer configuration.

    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.
    Exceptions
    ExceptionDescription
    Thrown when printerSettings is null.
    Remarks
    This method provides a flexible interface for printing page-based documents within the GrapeCity ActiveReports framework, leveraging the PrinterSettings class to customize the printing experience. It allows for detailed control over the printing process, catering to various user preferences and scenarios.
    Example
    The following example demonstrates how to print a page document with custom printer settings:
    var pageReport = new PageReport();
    PageDocument pageDocument = new PageDocument(pageReport);
    PrinterSettings printerSettings = new PrinterSettings
    {
        ShowPrintDialog = true,
        ShowPrintProgressDialog = true,
        UsePrintingThread = true,
        UseStandardDialog = true
    };
    bool printSuccess = pageDocument.Print(printerSettings);
    if (printSuccess)
        Console.WriteLine("Printing completed successfully.");
    else
    	Console.WriteLine("Printing failed.");
    See Also