Closed BillMa1992 closed 7 years ago
hmm maybe your problem is related to the fact that your map images requests are async and phantomjs is not waiting until all images are loaded to start the printing.
have you tried to activate a printing trigger?
you have the option to activate the waitForJS
option and then you just need to set the JSREPORT_READY_TO_START = true
variable in the javascript part (<script>
part) of your template, this will let you control exactly when phantomjs should start printing the page.
for example after activating the waitForJS
property of your template (a checkbox in jsreport studio) try to put a javascript like this in your template:
// ...html here...
<script>
// put a fake time, just to see if that your problem is indeed a race condition
// between phantomjs and your map images
setTimeout(function() {
window.JSREPORT_READY_TO_START = true; //this will start the pdf printing
}, 5000);
...
</script>
an example to give you and idea: https://playground.jsreport.net/studio/workspace/rkYn7WaCg/19
Thanks for your quick response. Yes, it's seems to be the problem. By setting "window.JSREPORT_READY_TO_START = true;" now I get more map successfully printed. However, there are still 2 maps that fail to print.
A lot of warnings like this:
and the error canceling the print looks like this:
it is something difficult to tell you what is happening (or if there is any kind of issue) without looking what you have in the template, the first warning seems like an error in the javascript part of your template
can you share here the content of your template (template, helpers etc)?
Thanks for your reply. I think the issue can be closed. Since it's something with Phantom.js. I may not use the async strategy to do the printing tasks. Again, thank you for your fast reply!
Best, Bill
I met a problem when I'm doing a report where each page has a map image.
I have another jsreport-image template to generate map images using url requests. And then I directly insert the image results into the report.
Best, Bill