Page 1 of 1
print out a file to default printer???
Posted: Fri Mar 10, 2006 3:19 am
by zinc
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....
Re: print out a file to default printer???
Posted: Fri Mar 10, 2006 6:47 am
by Chris Corbyn
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....
No. PHP runs on the server not the client.
You can use javascript to bring up the print dialog but you can't change the printer:
Posted: Sat Mar 11, 2006 11:03 am
by zinc
thx for the help
Posted: Sat Mar 11, 2006 12:51 pm
by John Cartwright
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.
Posted: Sun Mar 12, 2006 9:40 pm
by zinc
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.
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...
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
zinc's last post for non-aolspeakers
Posted: Sun Mar 12, 2006 9:52 pm
by feyd
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
Posted: Sun Mar 12, 2006 9:59 pm
by zinc
sorry for the language
Posted: Mon Mar 13, 2006 12:37 am
by John Cartwright
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 ......
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 start
Posted: Mon Mar 13, 2006 2:20 am
by zinc
thanks for the help....
Posted: Mon Mar 13, 2006 4:46 am
by onion2k
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>
Posted: Mon Mar 13, 2006 8:55 pm
by zinc
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>
thx for help but there is no possibility for me to limit the user's perference..........whether its IE or FF or Opera.....
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">
i need to break into a new line.....above shown is just a example....tried using <br> and it doesn't work.....
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