Page 1 of 1

Auto Print after report loaded

Posted: Wed Jan 04, 2017 6:29 pm
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.

Re: Auto Print after report loaded

Posted: Thu Jan 05, 2017 3:49 pm
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.

Re: Auto Print after report loaded

Posted: Thu Jan 05, 2017 5:53 pm
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();
}
}

Re: Auto Print after report loaded

Posted: Fri Jan 06, 2017 5:30 pm
by Alex K.
Hello,

Thank you for provided information.

Please let us know if you need any additional help.

Thank you.