$debug=0 // Mode debug => $debug=1 (ne fonctionne pas sous Internet Explorer) $debug=0; $conf_url_site = "#URL_SITE_SPIP" ; $conf_nom_site = "[(#NOM_SITE_SPIP|pdf_first_clean)]" ; // Recuperation et definition des differents elements $site="[(#NOM_SITE_SPIP|pdf_first_clean)]"; $rubrique="[(#TITRE|supprimer_numero|pdf_first_clean)][(#NOM_SITE_SPIP|pdf_first_clean)]"; $DateParution="[(#DATE_REDAC|affdate|pdf_first_clean)]"; $DateMiseEnLigne="[(#DATE|nom_jour)] [(#DATE|affdate|pdf_first_clean)]"; /*$auteur="[(#NOM|pdf_first_clean)]";*/ $motsclef="[(#TITRE|pdf_first_clean)]"; $yahoo="- [(#TITRE|supprimer_numero|pdf_first_clean)] - "; $logo_site=$site_logo_path; [$surtitre="(#SURTITRE|pdf_first_clean)";] [$titre="(#TITRE|SUPPRIMER_NUMERO|pdf_first_clean)";] [$soustitre="(#SOUSTITRE|pdf_first_clean)";] [$chapo="(#CHAPO|pdf_first_clean)";] [$descriptif="(#DESCRIPTIF|pdf_first_clean)";] [$texte= "(#TEXTE|pdf_first_clean)";] [$ps="(#PS|pdf_first_clean)";] [$notes="(#NOTES|pdf_first_clean)";] $copyright="Copyright © "."[(#NOM_SITE_SPIP|pdf_first_clean)]"."\nTous droits réservés"; $id_article = "#ID_ARTICLE"; $files_pdf = "article_".$id_article.".pdf" ; $file_out = $path_pdf . $files_pdf ; if (file_exists($file_out)) { clearstatcache; $damo = date(YmdHi , strtotime("#DATE_MODIF")) ; $dage = date(YmdHi , filemtime($file_out)) ; if ($damo > $dage) { unlink($file_out); } } header("Location: index.php"); exit; if ($debug == 1 && file_exists($file_out)) { unlink($file_out); } if (!file_exists($file_out)) { define('FPDF_FONTPATH',$class_path.'font/'); require_once($class_path.'fpdf.php'); require_once($class_path.'lib_pdf_global.php'); require_once($class_path.'lib_pdf_spip.php'); //-------------------------------- // Debut génération du PDF //-------------------------------- $pdf->debug=$debug; $pdf=new PDF_SPIP(); $pdf->SetCompression(false); $pdf->SetDisplayMode(fullpage, single ); // haut, gauche, bas, droite $pdf->SetAllMargins(12,15,12,10); $pdf->SetTitle($titre); $pdf->SetCreator($site); $pdf->SetCopyright($copyright); $pdf->SetSubject($rubrique); $pdf->SetKeywords($motsclef); $pdf->Buid($file_out); } if ($debug==1) { // Affiche le PDF directement dans l'onglet de Firefox // Ne fonctionne pas sous IE 6 SP2 : le pdf n'est pas reconnu (pris pour un fichier texte) header("Content-type: application/pdf"); header("location: ". $conf_url_site . "/" . $file_out); } else { // Vous voulez afficher un pdf header('Content-type: application/pdf'); // Il sera nommé $files_pdf // ATTENTION : pour "filename", mettre un nom de fichier court (.) // sinon IE 6 SP2 ne reconnaîtra pas le type de fichier // Semble poser problème sous IE6 SP1 // Ah, Microsoft, je vous jure ! header('Content-Disposition: attachment; filename=' . $files_pdf); // Le source du PDF original.pdf readfile($conf_url_site . "/" . $file_out); } exit; ?>