ALL :: ZONES :: printer help |
|||
| By: FiatLink |
Date: 29/04/2003 00:00:00 |
Points: 50 | Status: Answered Quality : Excellent |
|
hi, i have a dynamic page which generates from php, i want to send the dynamic page to printer directly without showing to user , how to do that any suggestiong pls |
|||
| By: VGR | Date: 29/04/2003 19:59:00 | Type : Answer |
|
| 1) use ob_start() and related functions in your script. Yhis is only adding three lines of PHP code in your existing script without changing anything to it. 2) send the bufferred output ( a simple string $variable) to wherever you want. To the printer of the customer, it's not possible, but you can send him back a page displaying the contents and then doing a (javascript) <script>document.print();</script> (or the like) |
|||
| By: Epistemo | Date: 29/04/2003 23:02:00 | Type : Comment |
|
| Okay, you lost me. What do you mean when you say: "i want to send the dynamic page to printer directly without showing to user" The use has to confirm the printer job? You could target the default printer of the visitor btw... You could use javascript and use php together with an onload command. In head: <SCRIPT LANGUAGE="JavaScript"> <!-- function yo(text){ text=document print(text) } //--> </script> then: <body onload="javascript:yo();"> Is this something your trying to do? |
|||
| By: RQuadling | Date: 29/04/2003 23:53:00 | Type : Comment |
|
| Is the printer local or remote? This is a PHP (which is server side) forum. So when you say print, I don't think it to be unreasonable to assume that you mean when a user comes to your site, you (i.e. a script on the server) wants to generate a local (i.e. serverside) report. If you mean you want the USER to get a report, then this is client side and JavaScript is the quickest way. I would also recommend using a hidden frame so that nothing is actually shown to the user. If you really do mean server side reporting (i.e. you have a line printer recording hits/logs/etc), then you can could use fopen() to open the printer (LPT1 on windows for example, I think something like lpr on *ix, not sure). You could then use fprintf to write out formatted data. Richard. |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








