I need to print receipts and invoices directly to printers

Discussion in 'PHP' started by Davyvile, Mar 29, 2008.

  1. #1
    I am working on an application that produces receipts and invoices. So I need a php code that will enable me to print these items directly to my printer without printing the whole web page. Please soomeone help.
     
    Davyvile, Mar 29, 2008 IP
  2. owenj

    owenj Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you wanting the print dialog to come up in a browser or be sent to the printer? What OS are you running?
     
    owenj, Mar 30, 2008 IP
  3. GazPoint

    GazPoint Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You don't need php for this. Use a print css file that will display:none the areas of the page you don't want so they won't be printed out. You can invoke the print dialogue in javascript onclick of a button, window.print() I think eg :

    <input type="button" onclick="javascript:window.print();" value="Pint your receipt" />
    HTML:
    Example print.css :

    div#header, div#sidebar, div#footer {display:none;}
    Code (markup):
    To include the print.css in your html :

    <link rel="stylesheet" type="text/css" href="print.css" media="print"  />
    HTML:
     
    GazPoint, Mar 30, 2008 IP