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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<?
//header("Content-Type: text/html; charset=utf-8");
header('Content-type: application/pdf; charset=utf-8"');
include("config.php");
include("lang/lang_$lang.php");
include("function_classif.php");
require_once(dirname(__FILE__).'/lib/tcpdf/tcpdf.php');
class MYPDF extends TCPDF {
//Page header
public function Header() {
$headerimage = dirname(__FILE__).'/img/GGM_FT_Header.jpg';
$this->Image($headerimage, 0, 0, 211, '', 'jpg', '', 'T', false, 300, '', false, false, 0, false, false, false);
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-10);
// Set font
$this->SetFont('helvetica', 'I', 8);
$this->SetTextColor(102,102,102);
// Page number
$this->Cell(0, 0, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
$footerimage = dirname(__FILE__).'/img/GGM_FT_Footer.jpg';
$this->Image($footerimage, 0, 291, 211, '', 'jpg', '', 'T', false, 300, '', false, false, 0, false, false, false);
}
}
$art = get_article($_GET['a']);
$class = get_classif_desc($_GET['c']);
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Author');
$pdf->SetTitle(str_replace(" ", "_",$art['article']));
$pdf->SetSubject('Sujet');
$pdf->SetKeywords($art['article']);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage();
$pdf->ln();
$pdf->SetFont('helvetica', 'B', 12);
$pdf->SetTextColor(60, 107, 181);
$pdf->Cell(100, 5, $art['article'], 0, 'L', 1, 0, '', '', true);
$pdf->SetTextColor(102,102,102);
$pdf->ln();
$pdf->SetFont('helvetica', 'B', 10);
$pdf->Cell(100, 5, $art['desc_c'], 0, 'L', 1, 0, '', '', true);
$pdf->SetFont('helvetica', '', 8);
$pdf->ln();
if ($art['photo_article']) {
$photo = $art['photo_article']; // image principal de l'article
} else {
$photo = $class['img']; //image principal de la classif si heritage
}
$content = get_image($photo,400) ;
$pdf->writeHTML($content, true, false, true, false, 'C');
$search = array('<br></li>', '<br></font>', '<font size="2"','Ω');
$replace = array('</li>', '</font>', '<font size="8"','Ω');
$pdf->ln();
if ($art['argumentaire']){
$content = str_replace($search, $replace, $art['argumentaire']) ;
} else {
$content = str_replace($search, $replace, $class['argumentaire']) ;
}
$pdf->writeHTML($content, true, false, true, false, '');
$pdf->ln(5);
$pdf->SetFont('helvetica', 'B', 8);
$pdf->Cell(40, 5, $carac_7, 0, 'L', 1, 0, '', '', true);
$pdf->ln();
$pdf->SetFont('helvetica', '', 8,'',true);
if ($art['desc_l'] != ""){
$content = str_replace($search, $replace, $art['desc_l']);
} else {
$content = str_replace($search, $replace, $class['desc']);
}
$pdf->writeHTML($content, true, false, true, false, '');
//Close and output PDF document
$pdf->Output($art['article'].'.pdf', 'I');
?> |
Partager