Skip to main content
A newer version of this page is available. .

Print Overview

  • 5 minutes to read

To publish report documents on the web, you can use the HTML5 Document Viewer or ASP.NET Document Viewer, whose server-side functionality is provided by the ASPxWebDocumentViewer and ASPxDocumentViewer classes, respectively. A server-side Document Viewer control hosted by a web application generates a final document in a representation suitable for being displayed in a web browser and passes it to the client to preview, navigate, export and/or print. The client-side functionality of these controls is provided by the ASPxClientWebDocumentViewer and ASPxClientDocumentViewerclasses.

This document provides information on printing reports from a client web browser.

Print in the HTML5 Document Viewer

The HTML5 Document Viewer supports pixel perfect document rendering, i.e., displays a report exactly as it will appear on paper. The printing functionality of this viewer is based on rendering the report in PDF with special settings and invoking the PDF plug-in’s Print dialog.

The ASPxClientWebDocumentViewer.Print method prints a report on the client side. This method can be triggered in the following cases.

  • When you click the Print button to print the entire report document or the Print Page button to print the currently active document page.

    HTML5DC_PrintButton

    HTML5DC_PrintPageButton

  • When executing a specific script on the client.

After the ASPxClientWebDocumentViewer.Print method is called, the HTML5 Document Viewer tries to use the PDF plug-in of the browser for printing. Depending on the plug-in detection result, there are two possible scenarios.

  • If the PDF plug-in is installed and enabled, its Print dialog is invoked. To print the document, specify the required settings in this dialog and click Print.

    EUD_HTML5DV_PrintDialog

  • If the PDF plug-in is disabled or is not installed, the Document Viewer exports the report document to a PDF file, and initiates its download instead of printing. The resulting PDF file contains a script that starts printing the document immediately after it is opened in a compatible viewer.

Print in the ASP.NET Document Viewer

The ASPxClientDocumentViewer.Print method is intended to print a report on the client side. It can be triggered in the following cases.

  • When you click the Print or Print Page button on the Viewer toolbar. The first button prints the entire document, while the second button prints the currently displayed document page.

    PrintInWeb_0

    PrintInWeb_1

  • When executing a specific script on the client (for instance, in the DocumentViewerClientSideEvents.ToolbarItemClick event).

After the Print method is called, one of the following two approaches is applied to print the report document.

  • Using the PDF plug-in

    If the PDF plugin is installed and enabled in a web browser, it is used to print a report document. In this case, the Document Viewer converts the document to PDF and passes it to the client-side where the Print dialog is initiated to print the resulting PDF file. Converting a document to PDF preserves its layout, thus the document printed using the PDF plug-in will look on paper exactly as it was designed (pixel perfect printing).

    To check the availability of this plug-in on a client web browser each time a report is committed to print, enable the DocumentViewerReportViewerSettings.PrintUsingAdobePlugIn option.

  • Using the native printing functionality of a web browser

    If the PDF plug-in is disabled or is not installed in a web browser, a report is printed using the default browser printing approach. The browser invokes its dedicated Print dialog and prints the document’s HTML layout as it is displayed by the Document Viewer without converting it to PDF. The following image illustrates the Print dialog of Microsoft® Internet Explorer.

    EUD_IE_PrintDialog

    The printing engine of a web browser can affect report printing by assigning custom print settings (such as paper kind, margins, etc.) to a document. This makes it impossible to guarantee consistent report printing. To properly print the report in this case, you need to manually specify all print settings. Moreover, since the Document Viewer displays one report page at a time, a web browser only prints the currently displayed page along with the rest of the irrelevant web page content. Other issues that relate to an incorrect report layout may go unnoticed and become evident only after the report has already been committed to be printed or exported.

    To makes it possible to secure consistent printing results, as well as avoid routinely evaluating the print settings prior to each printing operation, install the Adobe Reader® PDF plug-in as described in the corresponding section below.

Install and Activate the Adobe Reader® plug-in

To download and install the Adobe Reader® plug-in, use the following link: http://get.adobe.com/reader/. No software other than the Adobe Reader® should be installed on a machine for printing purposes. After finishing the installation, the plug-in should automatically be enabled in appropriate web browsers. To learn how to manually setup your browser to use this plug-in, refer to the Display PDF in browser document. For the changes to take effect, you may need to close and reopen the browser.

Note that many modern web browsers include their own PDF plug-ins, which automatically replace the Adobe Reader® plug-in. If you need to revert to the Adobe plug-in, refer to the Configure browser to use the Adobe PDF plug-in document.

See Also