PHP Server Side Printing

前端 未结 3 1428
终归单人心
终归单人心 2021-01-24 19:41

I\'ve been googling for the last few hours now and can\'t seem to find an answer. I did come close with this question

I\'ve got an intranet site on my windows server run

相关标签:
3条回答
  • 2021-01-24 20:24

    use the printer functions. they are an extension to php that is only available for php on windows. With that you can print to a local printer que. see the php manual

    0 讨论(0)
  • 2021-01-24 20:27

    In the past I've output a PDF from HTML (look at pisa -- python library for handling this), and then used shell_exec() to print the PDF.

    Not very glamorous, but it works. Also, this was on a linux server, so I'm not sure about the capabilities of command-line printing on a Windows box.

    0 讨论(0)
  • 2021-01-24 20:30

    I would think that your 'best' option would probably be trying to find a way to interact with the printer driver (does the manufacturer provide anything useful?).

    Otherwise you could try having a printMe function that adds the page URL to a db or something similar and then have a Scheduled task running a script every minute or so that prints any URLs that are listed. If you install firefox on your server you can then make it print without showing any prompts (use the Javascript window.print() function). Just make sure your scheduled task loads your script in firefox.

    Using this method would also mean that you could log who printed what and when. You could also allow printing of places other than the intranet site (be sure to check that the URL is from the intranet regardless of whether you decide to allow printing from other sites) by creating a bookmarklet.

    0 讨论(0)
提交回复
热议问题