Bonjour, j'essaie d'utiliser FPDF mais avec les variables contenant un espace et bien sur, j'ai une erreur.
Comment resoudre ce pb, j'ai bien essayer de mettre des liens relatifs mais c'est KO.
Au secours ;-)
le script :
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
49
50
51
52
53
54
55
56 // Définir quelques répertoires... $pdftkPath = 'C:\Program Files\xampp\htdocs\PDF\pdftk-1.12'; $pdfPath = 'C:\Program Files\xampp\htdocs\PDF\pdf'; $newPdfPath = 'C:\Program Files\xampp\htdocs\PDF\pdfnew'; // Editions à fusionner $pdfFiles = array( 'edition1.pdf', 'edition2.pdf', 'edition3.pdf' ); // Nom du fichier pdf généré $outputPDF = $newPdfPath . uniqid() . '.pdf'; // Création de la ligne de commande $cmd = $pdftkPath . DIRECTORY_SEPARATOR . 'pdftk.exe'; $params = ' %s cat output ' . $outputPDF . ' dont_ask'; $pdfList = ''; foreach ($pdfFiles as $key=>$pdfFile) { $pdfList .= '"' . $pdfPath . DIRECTORY_SEPARATOR . $pdfFile . '" '; } $params = sprintf($params, $pdfList); echo $cmd . $params; $var=system($cmd . $params); //$var=exec($cmd . $params); //$var=$cmd . $params; $shell = new COM('WScript.Shell'); $oExec = $shell->Exec($cmd . $params); $i = 0; // Temporisation du script PHP durant l'exécution du programme externe. while ($oExec->Status == 0) { // Estimation arbitraire pour détection du fonctionnement anormal de l'application à 30 secondes if ($i == 30) { trigger_error('Délai de traitement autorisé pour la génération du fichier dépassé. Merci d\'essayer à nouveau ultérieurement.', E_USER_ERROR); break; } sleep(1); $i++; } echo 'Durée du traitement : ' . $i . 's<br/>'; echo '<a href="file:\\' . $outputPDF . '">' . basename($outputPDF) . '</a><br/>'; var_dump($oExec); unset($oExec);
Partager