Export to Image Programmatically?

Stimulsoft Reports.JS discussion
Post Reply
nickdavies07
Posts: 28
Joined: Fri Jul 17, 2020 2:19 pm

Export to Image Programmatically?

Post by nickdavies07 »

Is it possible to export a report to a data:image/uri/base-64 to be saved in the database?
We'd like to look at showing a preview of a report on the home screen of our app, and clicking it takes the user into the report.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to Image Programmatically?

Post by Lech Kulikowski »

Hello,

Yes, you can export the rendered report to image format
https://www.stimulsoft.com/en/documenta ... export.htm

Thank you.
nickdavies07
Posts: 28
Joined: Fri Jul 17, 2020 2:19 pm

Re: Export to Image Programmatically?

Post by nickdavies07 »

Lech Kulikowski wrote: Thu Oct 01, 2020 3:30 pm Hello,

Yes, you can export the rendered report to image format
https://www.stimulsoft.com/en/documenta ... export.htm

Thank you.

Thanks for the link - I can't see from that link though where I can export to image? Only HTML, PDF, Word, Excel and CSV are listed.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to Image Programmatically?

Post by Lech Kulikowski »

Hello,

You can use the necessary StiExportFormat
https://admin.stimulsoft.com/documentat ... ormat.html

Thank you.
nickdavies07
Posts: 28
Joined: Fri Jul 17, 2020 2:19 pm

Re: Export to Image Programmatically?

Post by nickdavies07 »

Lech Kulikowski wrote: Mon Oct 05, 2020 1:32 pm Hello,

You can use the necessary StiExportFormat
https://admin.stimulsoft.com/documentat ... ormat.html

Thank you.
Hmm, I must be missing something.
I'm using Vue and after the report is rendered, I'm running the following:

Code: Select all

        computed: {
            viewer() {
                let options = new Stimulsoft.Viewer.StiViewerOptions();
                options.appearance.allowChangeWindowTitle = false;
                options.toolbar.showOpenButton = false;
                options.toolbar.showSaveButton = false;
                options.toolbar.viewMode = 2;

                return new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false);
            },

            report() {
                return new Stimulsoft.Report.StiReport();
            },
        },

	export() {
                this.report.renderAsync(() => {
                    this.report.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf);
                })
        }
Nothing at all seems to happen? Should I be doing something else? The function `export()` is called on button press.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to Image Programmatically?

Post by Lech Kulikowski »

Hello,

Please check:

Code: Select all

report.renderAsync(function () {
var data = report.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf);
Object.saveAs(data, "Report.pdf", "application/pdf");
})
Thank you.
Post Reply