Page 1 of 1

Access Printer through PHP

Posted: Tue Aug 28, 2007 6:01 am
by vinoth
hi all

Is there any possible to print the current PHP page in papers
How can I achieve this..

I need some code, suggestions regarding this

Thanks in adance

Posted: Tue Aug 28, 2007 6:12 am
by Steve Mellor
PHP doesn't really have the device control you're looking for. I would suggest looking at Javascript to print off a page.

Code: Select all

<a href="javascript:print()">PRINT THIS PAGE!</a>
Of course, being javascript you can call it whenever you like. A good solution I have used before is to make an i-frame on the page (1px X 1px) and load the page you want to print into that frame, that way you can use a separate page and have more control about which pictures are printed and where your line-breaks are.

Take a look at this:

http://www.htmlgoodies.com/beyond/css/a ... hp/3470341

for more information...

Posted: Wed Aug 29, 2007 1:05 am
by vinoth
is it any possible to print the particular Particular field instead of printing the entire web page

Posted: Wed Aug 29, 2007 2:59 am
by Steve Mellor
once again, I would load what you want to print in to a new page (in an i-frame) and then print that. It will give you much less trouble.

Posted: Wed Aug 29, 2007 3:07 am
by xpgeek
You can use special CSS for printing.
Also to print part of page - make special page for printing :)

Posted: Wed Aug 29, 2007 6:48 am
by vinoth
how can I use CSS for printing alone,
Is it possible?

Posted: Wed Aug 29, 2007 8:13 am
by xpgeek
Yes.
This is nice short tutorial http://www.alistapart.com/stories/goingtoprint/