To publish report documents on the web, you can use the ASP.NET Document Viewer or HTML5 Document Viewer, whose server-side functionality is provided by the ASPxDocumentViewer and ASPxWebDocumentViewer 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 ASPxClientDocumentViewer and ASPxClientWebDocumentViewer classes.
This document provides information on printing reports from a client web browser.
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.
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.
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.
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.
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.
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.