print out a file to default printer???
Moderator: General Moderators
print out a file to default printer???
hi....
as mentioned in the subject, are there any ways to allow to a user to click on a file link and automatically print out to a default printer using php????
thx....
as mentioned in the subject, are there any ways to allow to a user to click on a file link and automatically print out to a default printer using php????
thx....
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: print out a file to default printer???
No. PHP runs on the server not the client.zinc wrote:hi....
as mentioned in the subject, are there any ways to allow to a user to click on a file link and automatically print out to a default printer using php????
thx....
You can use javascript to bring up the print dialog but you can't change the printer:
Code: Select all
window.print();- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
hi...i dun quite get what u mean......cos the files are supposed to by uploaded by some users and the files can be in different format...Jcart wrote:you can dynamically generate a pdf document with auto print set to on, automatically open it and it will print.. which is basically what you are trying to achieve.
ie jpeg, gif, docs, txt etc
so another person maybe like the administratior of the site wants to print out the file directly ......
i dun understand wat u meant by dynamically generate a pdf document....
thx
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
zinc's last post for non-aolspeakers
zinc wrote:hi...i don't quite get what you mean......because the files are supposed to by uploaded by some users and the files can be in different format...
ie jpeg, gif, docs, txt etc
so another person maybe like the administratior of the site wants to print out the file directly ......
i don't understand what you meant by dynamically generate a pdf document....
thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
You can simply take the uploaded image and create a pdf document containing the image. The reason why you want to use a pdf document is you will have more control of printing. http://php.net/pdf is a good startbecause the files are supposed to by uploaded by some users and the files can be in different format...
ie jpeg, gif, docs, txt etc
so another person maybe like the administratior of the site wants to print out the file directly ......
It's possible to automatically print HTML using the default printer too if you're happy with it only working in IE .. and you're happy using some nasty ActiveX ..
Code: Select all
<html>
<head>
<script>
function ieExecWB( intOLEcmd, intOLEparam )
{
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
if ( ( ! intOLEparam ) || ( intOLEparam < -1 ) || ( intOLEparam > 1 ) )
intOLEparam = 1;
WebBrowser1.ExecWB( intOLEcmd, intOLEparam );
WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
Boo!
<input type="button" value="Print" onClick="ieExecWB(6, -1);">
</body>
</html>thx for help but there is no possibility for me to limit the user's perference..........whether its IE or FF or Opera.....onion2k wrote:It's possible to automatically print HTML using the default printer too if you're happy with it only working in IE .. and you're happy using some nasty ActiveX ..
Code: Select all
<html> <head> <script> function ieExecWB( intOLEcmd, intOLEparam ) { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); if ( ( ! intOLEparam ) || ( intOLEparam < -1 ) || ( intOLEparam > 1 ) ) intOLEparam = 1; WebBrowser1.ExecWB( intOLEcmd, intOLEparam ); WebBrowser1.outerHTML = ""; } </script> </head> <body> Boo! <input type="button" value="Print" onClick="ieExecWB(6, -1);"> </body> </html>
but i got another question ....not too sure if it should be place under here...
its with regards to html....
how do i insert a newline using html tool tip???
Code: Select all
<a href=# title="Free DHTML and JavaScripts">googled but unable to find .....found one site that says use LF of ctrl LF, but how do go about using it??
LF stands for NL line feed, new line in the ascii table..
when i use enter to go to newline for the title, it works for IE but not for FF....are there any other ways for it to work for FF??
thanks