Viewer options
createViewer options and methods: toolbar buttons, zoom, language, parameters, search, page navigation and keyboard shortcuts.
The viewer draws pages as SVG when they scroll into view. Keys: PageUp/PageDown, Ctrl+Home/End, Ctrl+P (print), Ctrl + wheel (zoom).
| Name | Type | Description |
|---|---|---|
definition | ReportDefinition | The report (JSON). |
data | ReportData | { rows: [...] } plus any other values used by expressions. |
fetchData | (params) => data | Promise | Load data for the parameters (on start and on 조회). |
params | object | Initial parameter values (over the defaults). |
lang | 'ko' | 'en' | Toolbar language (default ko). |
toolbar | { pages, zoom, print, pdf, xlsx, xlsxData, csv, params } | Buttons to show (csv is off by default). |
zoom | number | 'width' | 'page' | Initial zoom (default width). |
paramsOpen | boolean | Open the parameter panel at start. |
fileName | string | Base name of saved files. |
licenseKey | string | License key (or setLicenseKey once). |
onOutput | (e) => boolean | void | Promise | Before every print or export; return false to cancel. |
onReady | (e) => void | After every successful run: { pages, rows, ms, params }. |
onParamsSubmit | (params) => false | params | void | The user pressed Run: return false to stay on the panel, or changed parameters. |
onPageChange | (page, total) => void | The page in view changed (1-based). |
onError | (error, during) => void | Loading ('data'), layout ('layout') or print/save ('output') failed. |
pdfSecurity | { userPassword?, ownerPassword?, permissions? } | PDF password and permissions (AES-256). |
author | string | PDF metadata author. |
Viewer methods
| Name | Type | Description |
|---|---|---|
refresh() | Promise<void> | Run the report again. |
setData(data) / setParams(p) / setDefinition(def) | Promise<void> | Change data, parameters or the definition and re-run. |
goTo(page) / setZoom(z) | void | Navigate and zoom. |
print() | Promise<boolean> | Print (false when onOutput cancelled). |
report | Report | The report object below (toPdf, toXlsx…). |
destroy() | void | Remove the viewer. |