Open print dialog automatically when PDF is opened

699 views
Skip to first unread message

Elliot Fisher

unread,
Jun 30, 2015, 1:59:05 AM6/30/15
to wkhtmltop...@googlegroups.com
Hi there,

Has anyone figured out how to get the print dialog to auto-open when a wkhtmltopdf generated PDF file is opened? I'm using PDF-XChange Viewer and Javascript is enabled.

I've tried embedding the following code in the HTML: 
<script type="text/javascript">
    window.onload = function () {
        print();
    };
</script>

I've also set these switches:
--enable-javascript --javascript-delay 10000 --debug-javascript

Along with either: --run-script window.onload=function(){print();}; 
Or: --run-script print();

None of these things are working. Any help greatly appreciated.

Cheers,
Elliot

Ashish Kulkarni

unread,
Jun 30, 2015, 11:24:23 AM6/30/15
to wkhtmltop...@googlegroups.com
That has to run under the context of the PDF viewer's javascript
engine, and was already requested as an enhancement:

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1574

Unfortunately, it requires changes in the upstream Qt PDF generator --
hence not much progress since it was reported more than a year ago.

Elliot Fisher

unread,
Jun 30, 2015, 8:20:13 PM6/30/15
to wkhtmltop...@googlegroups.com
Hi Ashish,

Thanks for letting me know.

Cheers,
Elliot
Reply all
Reply to author
Forward
0 new messages