[]
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.
<html>
<head>
<meta charset="utf-8" />
<title>ActiveReportsJS Viewer: Printing</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/ar-js-viewer.css" />
<script type="text/javascript" src="scripts/ie-polyfills.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: 600px"></div>
<script>
function load() {
viewer = new ActiveReports.Viewer('#ARJSviewerDiv');
viewer.open('/reports/InvoiceList.rdlx-json');
}
function Print() {
viewer.print();
}
</script>
</body>
</html>
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:
Submit and view feedback for