Vous n'êtes pas identifié(e).
Pages : 1
Bonjour,
je suis entrain de développer une application sous PHP.
je n'arrive pas à faire l'impression d'une page sous PDF
ci-dessous mon code php. la partie du code dont je trouve des erreurs en rouge.
veuillez m'aider SVP.
Merci
<?php
session_start();
require_once('tcpdf/config/lang/fra.php');
require_once('tcpdf/tcpdf.php');
include ('config.php');class MYPDF extends TCPDF {
//Page header
public function Header() {
$db_table="parametres";
$query=mysql_query("SELECT * FROM ".$db_table);
$param_pdf=mysql_fetch_array($query);if($param_pdf[pieds_entete]==1){
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image$img_file = dirname(__FILE__).'/images/entete.png';
$img_file2 = dirname(__FILE__).'/images/footer.png';
$this->Image($img_file, 0, 0, $param_pdf[h_width], $param_pdf[h_height], '', '', '', false, 300, '', false, false, 0);
$body_page=297-$param_pdf[f_height];
$this->Image($img_file2, 0, $body_page,$param_pdf[f_width], $param_pdf[f_height], '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$this->setPageMark();}}// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-25);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(190, 10, 'Page :'.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');}}$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('GPV Oujda - version 1 -2013');
$pdf->SetTitle($_title);
$pdf->SetSubject($_title);
$pdf->SetMargins(15, 37, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, 35);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);$pdf->AddPage();
/////////////////////////////////////////////////////////$num_demande= intval($_GET["num_demande"]) ;
if($num_demande==0){
$html='fichier introuvable!';
}
else{
$sql="select * from demande where num_demande=".$num_demande;
/*$sql = "select * from condidat,demande,type_demande
where condidat.num_condidat=demande.num_condidat and demande.num_type=type_demande.num_type and type_demande.demande_traitee='1' and condidat.controle='0'
and num_demande= ".$num_demande ;*/
$req = mysql_query($sql) ;
if($result = mysql_fetch_object($req))
{
$html = '
<table><tr><td>Numero du dossier:</td><td>'.$result->num_demande.'</td></tr>
<table><tr><td>Numero du dossier:</td><td>'.$result->num_condidat.'</td></tr>
</table>';
}
else{
$html = 'erreur';}}$pdf->SetFont('helvetica', '', 10);
$pdf->writeHTML($html, true, 0, true, true);
$pdf->Output('doc.pdf', 'I');?>
Pages : 1