V1
V1

Print

The ActiveReportsJS Viewer provides a print option in the toolbar to print the reports opened in the viewer.

You can also add your own custom print functionality. The following example shows the complete implementation where a custom 'Click to Print' button calls the viewer.print() method from an 'onClick' event.

<head>
    <title>ActiveReportsJS Viewer: Printing</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="css/ar-js-viewer.css" />
    <script type="text/javascript" src="scripts/ie-polyfills.full.js"></script>
    <script type="text/javascript" src="scripts/ar-js-core.js"></script>
    <script type="text/javascript" src="scripts/ar-js-viewer.js"></script>
    <script>
        var viewer;
    </script>
</head>

<body onload="load()">
<button type="button" onclick="Print()">Click to Print</button>

    <div id="ARJSviewerDiv" style="height: 100%"></div>
    <script>
        function load() {
            viewer = new ActiveReports.Viewer('#ARJSviewerDiv', { ShowAbout: true });
            viewer.open('/reports/InvoiceList.rdlx-json');
        }

        function Print() {
             viewer.print();
        }
    </script>
</body>

One-Touch Print

The One-touch print feature of ActiveReportsJS Viewer enables users to print the reports without previewing. So, as you run the application and the viewer finishes loading the report, print dialog is displayed. The following example shows how one-touch print can be implemented using pageDocument.print() method.

function load() {
     //One Touch Printing
     var ARJS = GC.ActiveReports.Core;
     var pageReport = new ARJS.PageReport();
     pageReport.load('/reports/InvoiceList.rdlx-json')
       .then(() => pageReport.run())
       .then(pageDocument => pageDocument.print());
        }    

Note:

  • Only browser implemented print options are available in the Print dialog.
  • With One-touch printing, you can't send reports directly to printer without displaying the Print dialog.