Auto Print after report loaded

Stimulsoft Reports.JS discussion
Post Reply
Francine
Posts: 28
Joined: Wed May 13, 2015 10:56 pm

Auto Print after report loaded

Post by Francine »

I have some code where I load the report in the viewer and after the report is fully loaded I need to print to PDF.
How can I detect when the report is fully loaded and rendered so that I can call my function to print to PDF?

I have tried the onEndProcessData of the viewer and the report but the event is triggered before the report is fully rendered.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Auto Print after report loaded

Post by HighAley »

Hello.

You don't need to wait for loading of the report, you could render and export the report in your code.
Sorry, maybe we don't understand your problem right. We need more information about the issue.
Could you send us a sample with your Print to PDF function that reproduces the issue?

Thank you.
Francine
Posts: 28
Joined: Wed May 13, 2015 10:56 pm

Re: Auto Print after report loaded

Post by Francine »

I have my JavaScript code in the page header that loads the report in the viewer then if I call my JavaScript code to create the PDF in the document ready function (jquery) it will proceed before the report is rendered therefore the PDF file will be empty.

But I have found some code that seems to work fine so far. I added a JavaScript timer and in the timer I check if the report has finished rendering and if so I call the code to save to PDF.

Here is my timer code:
var myVar = setInterval(myTimer, 2000);

function myTimer() {
if (viewer.report.isRendered == true){
window.clearInterval(myVar);
saveReportPdf();
}
}
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Auto Print after report loaded

Post by Alex K. »

Hello,

Thank you for provided information.

Please let us know if you need any additional help.

Thank you.
Post Reply