Portekoi
lundi 26 mai 2008 à 07:49
Bonjour,
C'est possible et je l'utilise sous IE 6 :
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>MOn Document</title>
<meta name="description" content="">
<meta name="keywords" content="">
</head>
<script language="JavaScript">
DA = (document.all) ? 1 : 0;
function handle_error() {
alert("\nErreur : utilisez le boutton Print du navigateur.")
return true;
};
function fermer(){
opener = self;
self.close();
};
</script>
</head>
<body style="height:100%; padding:0px; margin:0px" onload="window.print();">
<script language="VBScript">
sub window_onunload
on error resume next
set WB = nothing
on error goto 0
end sub
sub print
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
on error resume next
if DA then
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
else
call WB.IOleCommandTarget.Exec(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,"","","")
end if
if err.number <> 0 then
if DA then
alert "Erreur :" & err.number & " : " & err.description
else
handle_error
end if
end if
on error goto 0
end sub
if DA then
wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
else
wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
end if
document.write "<OBJECT ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </OBJECT>"
</script>
<!-- Ton html ici -->
</body>
</html>
Pour le choix de l'imprimante, non, cela n'est pas possible.
Portekoi