I am trying to use stimulsoft viewer in our Angular 8 website. We have a node server that gets the mrt template files, renders them and return a XML file.
Our angular website should be able to read the xml (like a mdc file) and show the report.
I managed to show the report but the toolbar is not working. My code
package.json
Code: Select all
"dependencies": {
"stimulsoft-reports-js": "^2020.4.2-c",
..
},
...
"browser": {
"fs": false
}
Code: Select all
<app-content class="pdf-viewer">
<div id="stimulsoft-viewer"></div>
</app-content>
Code: Select all
constructor(
private userService: UserService,
private reportsService: ReportsService
) {
this.stimulsoftInit();
}
stimulsoftInit() {
Stimulsoft.Base.StiLicense.key = environment.stimulsoft_key;
const options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.showTooltips = false;
options.toolbar.showDesignButton = false;
options.toolbar.showAboutButton = false;
options.toolbar.showOpenButton = false;
this.viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false);
this.report = new Stimulsoft.Report.StiReport();
}
runViewer() {
this.loading = true;
this.viewer.report = null;
this.reportsService.downloadReport(this.selectedReport, this.form.getRawValue())
this.reportsService.downloadReport(this.selectedReport, this.form.getRawValue())
.pipe(finalize(() => this.loading = false))
.subscribe(
(response: HttpResponse<Text>) => {
const data = response.body;
this.report.loadDocument(data);
this.viewer.report = this.report;
this.viewer.renderHtml('stimulsoft-viewer');
},
error => {
console.log(error);
}
);
}