erreur sur roundedrect

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : erreur sur roundedrect

par Cypher_PHP » 25 mars 2008, 09:58

ah

oh j'ai honte... je vais un peu trop vite..

milles merci!!!

par Hywan » 21 mars 2008, 17:59

Bonjour

tu instancies FPDF et pas PDF. RoundedRect est déclarée dans PDF ;-).

erreur sur roundedrect

par Cypher_PHP » 21 mars 2008, 17:10

bonjour

je me suis retrouvé face à cet erreur. je ne comprend pas pourquoi cet erreur s'affiche alors qu'ayant testé un exemple de roundedrect, ca marche bien.

je pense que c'est à cause du conflit entre roundedrect et while?

merci bcp
voici son message:
Fatal error: Call to undefined method FPDF::RoundedRect() in C:\Program Files\Wamp\www\phpToPDF\beta5.php on line 53
voici le code php:
<?php
require('fpdf.php');

class PDF extends FPDF
{
// fonction roundedrect qui permet de créer un rectangle 
    function RoundedRect($x, $y, $w, $h,$r, $style = '')
    {
        $k = $this->k;
        $hp = $this->h;
        if($style=='F')
            $op='f';
        elseif($style=='FD' or $style=='DF')
            $op='B';
        else
            $op='S';
        $MyArc = 4/3 * (sqrt(2) - 1);
        $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k ));
        $xc = $x+$w-$r ;
        $yc = $y+$r;
        $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k ));

        $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
        $xc = $x+$w-$r ;
        $yc = $y+$h-$r;
        $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k));
        $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
        $xc = $x+$r ;
        $yc = $y+$h-$r;
        $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k));
        $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
        $xc = $x+$r ;
        $yc = $y+$r;
        $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k ));
        $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
        $this->_out($op);
    }

    function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
    {
        $h = $this->h;
        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k,
            $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
    }
}
// instanciation de la dérivée
$pdf=new FPDF();
$pdf->AddPage();
$pdf->AliasNbPages();
// création d'un titre 
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,"Voici votre carte de visite: ". $_POST['prenom']." ".$_POST['nom']);

  
   $i = 0;
while ($i < 4)
{
// creation de rectangles
$pdf->SetLineWidth(0.1);
$pdf->SetFillColor(192);
$pdf->RoundedRect(8, 30, 93, 46, 0, 'DF');

// insertion d'image
$pdf->Image('carte_visite_haut.jpg',10,(62*$i + 50),0);
$pdf->Image('carte_visite_gauche2.jpg',10,(62*$i + 72),0);

// création du contenu de texte via formulaire
$pdf->SetFont('Arial','B',11);
$pdf->Text(48,(62*$i + 78),$_POST['prenom']." ".$_POST['nom'],0,1);

$pdf->SetFont('Arial','I',9);
$pdf->Text(48,(62*$i + 82),$_POST['grade'],0,1);
$pdf->Text(48,(62*$i + 86),$_POST['division'],0,1);
$pdf->Text(48,(62*$i + 90),$_POST['service'],0,1);

$pdf->SetFont('Arial','b',10);
$pdf->SetTextColor(28,68,74);
$pdf->Text(46,(62*$i + 95),$_POST['mail'],0,1);


$pdf->SetFont('Arial','',6,5);
$pdf->SetTextColor(00,00,00);
$pdf->Text(39,(62*$i + 102),"Tél. : ". $_POST['tel']." - Fax : ". $_POST['fax']." - Port. : ".$_POST['portable'],0,1);

$pdf->Image('carte_visite_haut.jpg',108,(62*$i + 50),0);
$pdf->Image('carte_visite_gauche.jpg',108,(62*$i + 72),0);

$pdf->SetFont('Arial','B',11);
$pdf->Text(148,(62*$i + 78),$_POST['prenom']." ".$_POST['nom'],0,1);

$pdf->SetFont('Arial','I',9);
$pdf->Text(148,(62*$i + 82),$_POST['grade'],0,1);
$pdf->Text(148,(62*$i + 86),$_POST['division'],0,1);
$pdf->Text(148,(62*$i + 90),$_POST['service'],0,1);

$pdf->SetFont('Arial','b',10);
$pdf->SetTextColor(28,68,74);
$pdf->Text(146,(62*$i + 95),$_POST['mail'],0,1);


$pdf->SetFont('Arial','',6,5);
$pdf->SetTextColor(00,00,00);
$pdf->Text(139,(62*$i + 102),"Tél. : ". $_POST['tel']." - Fax : ". $_POST['fax']." - Port. : ".$_POST['portable'],0,1);

// cree 
$i = $i +1;

}

$pdf->Output();
?>