Open BluewaterBeach opened 7 years ago
jsPrintSetup.print()
is asynchronous.
The simplest way is to give timeout between calls.
any chance you could give me an example. Thanks!
You can see sample here https://github.com/edabg/jsprintsetup/issues/35#issuecomment-274731943
I am using JSPrintSetup to generate a PDF file and a PS file. I need to know if I can just do:
That would call one output process after the other. The assumption is that the PDF file is completely generated in a synchronous way and that function is completed. Then it is clear to change the settings and call print() again to generate the PS file.
<script>
...
jsPrintSetup.setOption('outputFormat', 'PDF');
jsPrintSetup.setOption('toFileName', 'output.pdf');
jsPrintSetup.print();
jsPrintSetup.setOption('outputFormat', 'PS');
jsPrintSetup.setOption('toFileName', 'output.ps');
jsPrintSetup.print();
</script>
If it is asynchronous, then calling print() returns immediately and then there might be an issue changing the jsPrintSetup options and calling print again.
I would assume it is synchronous but a lot of javascript libraries use async. It isn't clear in the docs.
Great add-on!
Thanks! Alex.