1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <script language="javascript" type="text/javascript">
function JPrint(){
// Crée le WScript
var objWScriptShell = new ActiveXObject("WScript.Shell");
// Envoie des commandes "clavier"
objWScriptShell.SendKeys("(%f)u");
// Change l'en-tête
objWScriptShell.SendKeys("(%h)"); // En-tête
objWScriptShell.SendKeys("Page (+7)p of (+7)(+p)"); // Page x sur y
objWScriptShell.SendKeys("(%f)"); // Pied de page
objWScriptShell.SendKeys("{BS}"); // None
// Change en paysage
objWScriptShell.SendKeys("(%a)");
objWScriptShell.SendKeys("(%t)"); //définit la marge du haut
objWScriptShell.SendKeys("0.40");
objWScriptShell.SendKeys("(%b)"); //définit la marge du bas
objWScriptShell.SendKeys("0.40");
objWScriptShell.SendKeys("~"); // Entre O.K.
setTimeout("window.print()",500);
}
</script> |
Partager