print

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

print

Post by jaylin »

hi all,

is it possible to print some text, html coded tables, images by php? if yes, plz point me the ways

regards,
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

echo()
printf()
sprintf()
etc.

I suggest you download the manual and read through it.
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

Post by jaylin »

not print of the page. is print out through printer. also, i dun want javascript window.print. :D
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

jaylin wrote:not print of the page. is print out through printer. also, i dun want javascript window.print. :D
explain
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

printer is attached to the clients machine, php is running on server, php cannot directly interact with the client's machine, so php cannot interact with the printer.

Sorry but that is the way of the world, you might just be stuck with the javascript option.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

It's possible to automatically print a page in two ways:

1. Generate a PDF of the content and embed some javascript to automatically print it. Complicated, hassle to update the layout, difficult to do dynamically, requires Acrobat on the client computer, but it will work if the user has JS switched off in their browser.

2. Use an instance of IE's ActiveX browser object and send it the "print without dialogue" command. Complicated again, only works in IE, and will probably stop working when Microsoft's ActiveX update is out in about a month.

All-in-all it's probably not worth doing. Just let the user click thier print button and see the print dialogue.
Post Reply