Je refais un site web et pour la première fois je dois toucher au FPDF, donc je suis un poil perdu.
Le but de la page est d'afficher une liste de clients sur un pdf avec un petit logo.
La page existante est :
<?PHP
require('ClassPHP/fpdf/fpdf.php');
//Recuperation des Informations
include('ClassPHP/connex.php');
$badges = array();
$cnx = new mysql();
$cnx->connect("localhost", "root", "");
$cnx->select_db("db");
$sql1 = "SELECT * FROM `tb_flag_temp` ";
$req1 = mysql_query($sql1);
while($data1 = mysql_fetch_assoc($req1))
{
$badges[] = $data1['name'];
}
$count = count ($badges);
$pWidth = 420;
$pHeight = 297;
$fWidth = 420;
$fHeight = 110;
$pageMargin = 0;
$markerLength = 16;
// Creating PDF file
$pdf = new FPDF('L', 'mm', 'A3');
$pdf->SetDisplayMode('fullpage', 'single');
$pdf->SetCompression(true);
$pdf->SetMargins($pageMargin, $pageMargin);
$pdf->SetFillColor(0);
$pdf->SetDrawColor(0);
$pdf->SetFont('helvetica', 'b');
$tagsDone = 0;
for ($i = 0; $i < $count; $i++)
{
$pdf->AddPage();
for ($j = 0; $j < 2; $j++)
{
// First part
$x = 0;
$y = $j * $fHeight;
// -- logo
$imgX = $x + (($j % 2) ? ($fWidth - $fHeight) : 0);
$pdf->Image("image/alliances2.jpg", $imgX + 25, $y + 25, 60, 60);
// -- Bottom border
$pdf->Line($x, $y + $fHeight, $x + $markerLength, $y + $fHeight);
$pdf->Line($pWidth, $y + $fHeight, $pWidth - $markerLength, $y + $fHeight);
$pdf->Line($pWidth / 2 - $markerLength, $y + $fHeight, $pWidth / 2 + $marketLength, $y + $fHeight);
$pdf->SetFontSize(80);
$l = 1;
$pdf->SetXY($x, $y + ($fHeight / 2) * $l);
$ligne= explode("=", $badges[$i]);
if (isset( $ligne[1])){
$pdf->SetXY($x, $y + ($fHeight / 2) * $l-5);
$pdf->Cell($fWidth, 0, $ligne[0], 0, 0, 'C');
$pdf->SetXY($x, $y + ($fHeight / 2) * $l+20);
$pdf->Cell($fWidth, 0, $ligne[1], 0, 0, 'C');
}
else{
$pdf->SetXY($x, $y + ($fHeight / 2) * $l);
$pdf->Cell($fWidth, 0, $ligne[0], 0, 0, 'C');
}
}
}
//$sql = "TRUNCATE TABLE tb_flag_temp";
//mysql_query($sql) or die(mysql_error());
$pdf->Output();
?>
Le message d'erreur est celui-ci : imageshack.us/a/img803/1290/pdfr.png (Je peux pas mettre les liens le site les signalent en spam.) J'ai lu w3.u-grenoble3.fr/epal/dossier/fpdf/doc/
et obligement.free.fr/articles/fpdf.php
J'ai pu comprendre 2-3 choses mais rien qui n'a pu résoudre mon problème.
Merci,
Cordialement,
Blutz