Page 1 of 1

Export to Image Programmatically?

Posted: Thu Oct 01, 2020 8:00 am
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.

Re: Export to Image Programmatically?

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

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

Thank you.

Re: Export to Image Programmatically?

Posted: Sun Oct 04, 2020 8:21 pm
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.

Re: Export to Image Programmatically?

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

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

Thank you.

Re: Export to Image Programmatically?

Posted: Tue Oct 06, 2020 1:33 pm
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.

Re: Export to Image Programmatically?

Posted: Wed Oct 07, 2020 6:34 pm
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.