130,7 → 130,6 |
$this->fichier_pdf = $this->chemin_pdf.''.$nom_fichier.'.pdf'; |
|
if (file_exists($this->fichier_pdf) == false) { |
|
$donnees = $this->obtenirDonnees(); |
$this->construireHtml($donnees); |
if ($this->transformerHtmlEnPdf() == false) { |
138,6 → 137,7 |
} |
} |
$this->envoyerPdfAuNavigateur(); |
$this->nettoyerFichiersTmp(); |
// ATTENTION : on doit stopper l'exécution de Papyrus sinon du HTML inutile est ajouté à la fin du fichier PDF |
exit; |
} |
182,7 → 182,6 |
header('Content-type: application/pdf'); |
header('Content-Disposition: attachment; filename='.$nom_fichier.'.pdf'); |
readfile($this->fichier_pdf); |
$this->nettoyerFichiersTmp(); |
} |
|
private function nettoyerFichiersTmp() { |
193,6 → 192,9 |
foreach ($objets as $objet) { |
$chemin = $dossierStockage.$objet; |
if (is_file($chemin)) { |
if (substr($chemin, -5) == '.html') { |
unlink($chemin); |
} else { |
$filemtime = @filemtime($chemin); |
if ($filemtime !== false) { |
$suppression = (time() - $filemtime >= self::DUREE_DE_VIE_PDF) ? true : false; |
205,6 → 207,7 |
} |
} |
} |
} |
|
//version WKHTMLtoPDF en ligne de commande |
private function transformerHtmlEnPdf() { |