Bonjour,
J'ai un petit problème : je dois réaliser l'impression d'environ 600 pages html. Pour ce faire, j'utilise la fonction javascript print puis recharge la page avec l'identifiant de la page suivante à imprimer. Cependant, lorsque mon script est ''complet'', il s'arrête après que l'impression soit faite : tout le code après est ignoré. Lorsque je commente la ligne pour imprimer mon code fonctionne normalement.
Je ne comprend pas pourquoi...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 <?php include "./dao.php"; ?> <script src="./jquery/jquery-2.2.3.min.js"></script> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="./stylePrint.css" /> <title>Fiche materiel</title> </head> <body> <center> <?php if(isset($_GET['id'])){ $mat = $dao->getMateriel($_GET['id']); if($mat){ $noinv = $mat->getNoInventaire(); echo ' <h3>'.$noinv.'</h3> <img src="./img/'.$_GET['id'].'.png"> '; echo '<script> window.print(); </script>'; //imprime la page courante. Bloque le script (non voulu) $_GET['id']++; header("Refresh:0, url=print.php?id=".$_GET['id']); } } else{ echo ' <h3>Lancer l\'impression</h3> <input type="submit" value="Valider" id="print"> '; } ?> </center> <script> $("#print").click(function(){ window.location.replace("print.php?id=1"); }); </script> </body> </html>
Merci de votre aide
Partager