Web Analytics Made Easy -
StatCounter print out php page in paper - CodingForum

Announcement

Collapse
No announcement yet.

print out php page in paper

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • print out php page in paper

    i would like to print a php page on a paper. I want the page to be printed exactly like what is on the screen. The page has textbox, table, buttons and etc. Is it possible? Can someone please show me how to code?

  • #2
    Is the printer accessible from the server?
    De gustibus non est disputandum.

    Comment


    • #3
      I'm confused, can't you just open it in a browser and print?

      Otherwise, if your on linux you could try...

      Code:
      $> /path/to/php myPhpFile.php | lpr
      Create accessible online surveys -::- Koobten.com - compare netbook prices and reviews -::- Affordable, reliable hosting for less than $20 per year
      Zend Certified Engineer

      Comment


      • #4
        Another possibility would be that you want the page to be printed on the user's printer.

        Like a button on the page called 'Print'?

        This is not something that is possible using PHP, since you are wanting to perform client-side actions. As a result, you need to use something like JavaScript or VBScript.

        This is something that is not quite that easy since they can be browser dependent -- especially printing. The main reason is security. For example, imagine visiting a website that prints an infinite number of pages (using an inifinite loop possibly) on your printer. Believe it or not, there are some sick people out there that would try to take advantage of this security hole online. As a result, IE and Netscape, among others, have disallowed the ability for certain actions.

        I think you can print but it will probably just bring up the print dialog box. Unfortunately, this is the best that can be done.

        For information about these client-side techniques, I've included the following links:
        http://developer.irt.org/script/print.htm
        http://www.taltech.com/TALtech_web/s..._Printing.html

        Of course you have to keep in mind that you have Windows, Mac, and Linux users, among others.

        Hope that helps,
        Sadiq.

        Comment


        • #5
          You can do it with php...

          http://uk.php.net/printer

          Comment


          • #6
            Re: print out php page in paper

            Originally posted by hosefo81
            i would like to print a php page on a paper. I want the page to be printed exactly like what is on the screen. The page has textbox, table, buttons and etc. Is it possible? Can someone please show me how to code?
            You can't. No way.
            The Server - where the PHP Code is executed - has no idea how the HTML Code looks in the different Clients.

            The only way is to generate a PDF and print that - if there is any printer available for the server. If you print HTML or PHP Files you'll get the code of those files and not the Browser-appeareance.
            www.united-scripts.com
            www.codebattles.org

            Comment

            Working...
            X