Print from Chrome without the print dialogs? Using Greasemonkey userscript maybe?

后端 未结 4 1494
广开言路
广开言路 2020-12-13 02:15

We\'re developing a browser-based warehouse app that needs to print labels and invoices regularly. We want to be able to print to the local printer without clicking through

相关标签:
4条回答
  • 2020-12-13 02:46

    There's no way to do this with only JavaScript.

    0 讨论(0)
  • 2020-12-13 02:52

    You can do if you start your chrome (v18+) with the --kiosk --kiosk-printing switches.

    You can see it from this video https://www.youtube.com/watch?v=1ewep-ZT64E

    0 讨论(0)
  • 2020-12-13 02:52

    You can put a button on the form you are generating, then using embedded javascript in the pdf itself, cause printing to happen silently.

    There are various ways to print a document without requiring user interaction. One way is to use the doc object’s print method and set the bSilent attribute to true, as shown in “Printing PDF Documents” on page 79 and in the following example: this.print({bUI: false, bSilent: true, bShrinkToFit: true});

    http://partners.adobe.com/public/developer/en/acrobat/sdk/AcroJSGuide.pdf

    Take a look at the silent printing section under Print Production.

    0 讨论(0)
  • 2020-12-13 02:53

    Here's a batch file example I've created based on the answer provided by @russenreaktor:

    @echo off
    start "Chrome" chrome --kiosk --kiosk-printing --url http://www.google.com
    
    0 讨论(0)
提交回复
热议问题