Hi All,
I'm using the following code to print the current html page to my local printer
ob_start();
$content = ob_get_contents();
$handle = printer_open("HP Deskjet F2400 series");
printer_write($handle, $content);
printer_close($handle);
the printer is working and print the html file (not the rendered page)
how can I render the page and send it to the printer?
when I add: printer_set_option($handle, PRINTER_MODE, "raw"); the printer is not responding, I'm using php version 5.3.0
thanks in advance,
Eido
how to print the current html page from php
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: how to print the current html page from php
I don't think you can do what you want using php. php can take the process only as far as producing the html of the web page. The page is actually rendered by a browser. Without a browser, you cannot see a rendered web page, and you similarly cannot print one.
Re: how to print the current html page from php
eidos,
The output buffer (which is turned on by ob_start()) does not suppose to contain the rendered page, it actually stores the output, which is "echoed" by the script. Which is HTML in most cases.
So, could you specify for what purpose you need to get the rendered page in PHP ?
Actually, it is much easier to print the rendered page using JavaScript.
The output buffer (which is turned on by ob_start()) does not suppose to contain the rendered page, it actually stores the output, which is "echoed" by the script. Which is HTML in most cases.
So, could you specify for what purpose you need to get the rendered page in PHP ?
Actually, it is much easier to print the rendered page using JavaScript.