page == 1) {
$title = $this->data['titre'];
// $height = 20;
$max_length = 55;
if(strlen($title ) > $max_length){
$first = substr($title, 0, $max_length);
$last = substr($title, $max_length);
$title = trim($first).'
'.trim($last);
}
$this->SetTextColor(0, 0, 0);
// Logo
$image_file = 'https://www.terrenourriciere.org/pram/logo_pram.jpg';
// $this->Image($image_file, 165, 5, 30, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
$header = '
| ';
$header .= 'Retour d\'expérience '; $header .= ''.$title.''; $header .= ' | ';
$header .= '';
$header .= ' | ';
$header .= '||
| ";
$footer .= ' Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages().' '; $footer .= " | ";
$footer .= ' Retour d\'expérience - PRAM Occitanie '; $footer .= " | ";
// $footer .= ' |
"; var_dump($pdf->site_info); echo ""; $pdf->data = []; if(isset($_GET['article'])){ $sql = 'SELECT * FROM pram_articles WHERE id_article='.intval($_GET['article']); $req = $db->query($sql); $errordb=$db->errorInfo(); if($errordb[2]!='') exit('Erreur SQL !
"; var_dump($pdf->data['porteur']); echo ""; } }else{ die("Aucun article trouvé"); } $url = $pdf->site_info['adresse_site']."/spip.php?page=fiche-pdf&projet=".$pdf->data['id_article']."&var_mode=recalcul"; $content = ''; $fp = @fopen($url,"r"); //lecture du fichier if($fp != ''){ while (!feof($fp)) { //on parcoure toutes les lignes $content .= fgets($fp, 4096); // lecture du contenu de la ligne } fclose($fp); } // $url = "https://".$_SERVER['SERVER_ADDR']."/spip.php?page=fiche-pdf&projet=".$pdf->data['id_article']."&var_mode=recalcul"; $host = "Host: ".$_SERVER['SERVER_NAME']; // echo "
"; var_dump($host); echo ""; // echo "
"; var_dump($url); echo ""; // $c = curl_init(); // $headers = array($host); // curl_setopt($c, CURLOPT_HTTPHEADER, $headers); // curl_setopt($c, CURLOPT_URL, $url); // curl_setopt($c, CURLOPT_RETURNTRANSFER, true); // curl_setopt($c, CURLOPT_TIMEOUT, 1); // curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101'); // curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 5); // $content = curl_exec($c); // $context = stream_context_create(array('http' => array('header'=>'Connection: close\r\n'))); // $content = file_get_contents($url, false, $context); // echo "
"; var_dump(array($head, $errStr, $errNum, $ci)); echo ""; // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('PRAM'); $pdf->SetTitle($pdf->data['titre']); $pdf->SetSubject('Retour d\'expérience'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(10, 25, 10); $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); // add a page $pdf->AddPage(); // exit($content); // $tbl = $tbl_content; $pdf->writeHTML($content, true, false, true, false, ''); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('Titre'.'.pdf', 'I'); die(); //============================================================+ // END OF FILE //============================================================+ ?>