That is , I want to know if it's possible to
use php on web, maybe a "print" submit button to output somthing directly to client's local printer?

Since I had not read any about this function
in php manual, maybe you have other ways to satisfy such requirement via javascript or something else "browser independent".

any suggestion would be greatly appreciated.
chris

    PHP can not make the client's machine do anything else than HTML can (and JavaScript).. But that is just because that is what the client gets. The page he sees is generated on the server before it is sent to the client. Therefor in order to make the clien print a page is imposible with only PHP....

    Andreas

      And may I add that this is a very good thing!
      Imagine clicking a page and automatically your printer starts printing... eek!

        Hi,

        simply use JavaScripts print function:

        place this code into your PHP page, that's supposed to be printed (or inside a template, that dynamically grasps content from a DB/static HTML/XML whatever...)

        function print() {

        if(!IE4mac) {
        Check = confirm("Print this page now?","");
        if (Check) window.print();
        }
        }

        you can activate the printing with a link or within the onLoad handler inside the <BODY> tag.

        The User still has to manually launch the print bc the "Print" window shows up first, which needs a OK confirmation.

        Hope this helps
        Tom

          Write a Reply...