Jump to content

Printing to a users printer


niche

Recommended Posts

I've reviewed PHP's printer functions, but it's not obvious that I can use these functions to print on a user's (client's)printer. Since PHP is for server side scripts, is it best to think of PHP's printer functions for use with printers physically connected to my server and not for printers connected to a client's machine?Thanks

Link to comment
Share on other sites

Yes. Exactly. Those functions are for printing to a printer on the server. If you think about it, there's no way PHP could connect to a client's printer to begin with... not without some kind of a plug-in at least though, but at that point, you aren't even using PHP. You're using the plug-in itself.

Link to comment
Share on other sites

So generally, which scripting language or languages should I think about using and what would be the key functions I should consider using?

Link to comment
Share on other sites

So generally, which scripting language or languages should I think about using and what would be the key functions I should consider using?
For printing on a client's printer? There's no scripting language for that. No way from the web (and thank god!). You could only ask the user to install a desktop program, which could in turn download the thing that must be printed, and print it. There's no direct and easy way to create such a program. You need to know C++ and the Windows API to do it.The easiest way to print anything on the client side is to ask the user to print it and/or by creating a print link with JavaScript, like:
<a href="java script:window.print()">Print this page</a>

which when clicked will prompt the user to print. "Prompt" is the keyword here - if you want to bypass the user's permission, you can't. To bypass it, you need to make them install a program as described above.

Link to comment
Share on other sites

Thanks to boen_robot. You saved me a bunch of time.

Link to comment
Share on other sites

There is also a way (don't ask me how) to get the Adobe PDF plugin to print a PDF document using a web page (JavaScript?). This is what Google Docs uses when you ask it to print something.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...