[]
This page provides a detailed overview of the ActiveReportsJS Report Viewer component. You can check Get Started tutorial for a concise guide for integrating this component to a pure JavaScript application.
To use ActiveReportsJS Viewer component in a pure JavaScript application, it should include the following scripts and styles:
ar-js-core.js: required, provides the core functionality
ar-js-viewer.js: required, provides the viewer component
ar-js-ui.css: required, provides the common style for ActiveReportsJs components
ar-js-viewer.css: required, provides the default style for viewer component
ar-js-pdf.js: optional, provides export to PDF
ar-js-tabular-data.js: optional, provides export to Tabular Data(CSV) format.
ar-js-html.js : optional, provides export to HTML
The easiest way to include these scripts is to use CDN references, for example:
<link
rel="stylesheet"
href="https://cdn.mescius.com/activereportsjs/6.latest/styles/ar-js-ui.css"
type="text/css"
/>
<link
rel="stylesheet"
href="https://cdn.mescius.com/activereportsjs/6.latest/styles/ar-js-viewer.css"
type="text/css"
/>
<script src="https://cdn.mescius.com/activereportsjs/6.latest/dist/ar-js-core.js"></script>
<script src="https://cdn.mescius.com/activereportsjs/6.latest/dist/ar-js-viewer.js"></script>
<script src="https://cdn.mescius.com/activereportsjs/6.latest/dist/ar-js-pdf.js"></script>
<script src="https://cdn.mescius.com/activereportsjs/6.latest/dist/ar-js-tabular-data.js"></script>
<script src="https://cdn.mescius.com/activereportsjs/6.latest/dist/ar-js-html.js"></script>Alternatively, you can download these scripts and styles from the ActiveReportsJS Download Page. You can find them in the dist and styles folders of the download package, respectively.
Finally, @mescius/activereportsjs package can be installed in an application's folder and these scripts can be referenced from node_modules\@mescius/activereportsjs\dist\ and node_modules\@mescius/activereportsjs\styles\ folders
After the scripts and styles are loaded, the Viewer component can be initialized by invoking the MESCIUS.ActiveReportsJS.ReportViewer.Viewer constructor and passing the CSS selector of the hosting element and optional initialization options, for example:
<body>
<div id="viewer-host"></div>
<script>
var viewer = new MESCIUS.ActiveReportsJS.ReportViewer.Viewer("#viewer-host", {ParameterPanelLocation: 'top'});
</script>
</body>The instance of MESCIUS.ActiveReportsJS.ReportViewer.Viewer exposes the methods and properties that you can use to customize the viewer appearance, preview, print, or export reports.