visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

ALL :: ZONES :: printer help


By: FiatLink Belgium  Date: 29/04/2003 00:00:00  English  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 English  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 English  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 English  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

EContact
browser fav
page generated in 303.644900 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page