je crée un fichier pdf en php contenant un tableau devis d'une commande avec pour chaque article son image à coté.j'utilise fpdf mais quand il ya plusieurs articles ma mise en page devient fausse.
voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
 
<?php
	require('fpdf/fpdf.php');
	include "connexion/connexion.php";
	$code_cde=( @$_POST["code_cde"] )
             ?  @$_POST["code_cde"]
			 :  @$_GET["code_cde"] ; 
 
echo "<input type=hidden value=$code_cde name=\"code_cde\" />";			 
	 ob_end_clean(); 	
$pdf=new FPDF('P','mm','A4');
$pdf->SetAutoPageBreak(true, 30);
$pdf->AliasNbPages();
mysql_select_db($database_connexion, $connexion);
$insertSQL1 = "select code_article,designation,quantite,colisage,remise,tarif,prix_unitaire,total_ligne,nom_client,date_commande from commandes where code_commande =".$code_cde."";	
$query1 = mysql_query($insertSQL1,$connexion) or die(mysql_error());
$row1  = mysql_fetch_row($query1);			 
	if($row1){
 
$pdf->Open();
$pdf->AddPage();
$pdf->Image('images/Logo SOLEA Afrique.jpg',5,5, 35, 25);
 
//Police Arial gras 12
	//Arial gras 15
	$pdf->SetFont('Arial','B',9);
	$pdf->SetDrawColor(255,255,255);
	$pdf->SetFillColor(255,255,255);
	$pdf->SetTextColor(0,0,0);
		//Epaisseur du cadre (1 mm)
$pdf->SetLineWidth(0.00);
 
$bp='BP:27250 - Dakar';
$tel ='Tél.: 33 821 50 80';
$tel = utf8_decode($tel);
$fax= 'Fax : 33821 10 09';
$email = 'E-mail:tham@solea-afrique.com';
$site = 'Site : www.solea-afrique.com';
$pdf->SetXY(43,5);
$pdf->Cell(20,4,$bp,1,1,'C',true);
$pdf->SetXY(43,10);
$pdf->Cell(20,4,$tel,1,1,'C',true);
$pdf->SetXY(43,15);
$pdf->Cell(20,4,$fax,1,1,'C',true);
$pdf->SetXY(54,20);
$pdf->Cell(20,4,$email,1,1,'C',true);
$pdf->SetXY(52,25);
$pdf->Cell(20,4,$site,1,1,'C',true);
/****/
$pdf->SetFont('Times','B',15);
$pdf->SetTextColor(51,102,255);
$pdf->SetXY(110,5);
$pdf->Cell(20,4,'GLOBO',1,1,'C',true);
$pdf->SetXY(146,5);
$pdf->Cell(20,4,'LINEA VERDACE',1,1,'C',true);
$pdf->SetXY(185,5);
$pdf->Cell(20,4,'KANLUX',1,1,'C',true);
$pdf->SetXY(110,20);
$pdf->Cell(20,4,'GLOBO',1,1,'C',true);
$pdf->SetXY(146,20);
$pdf->Cell(20,4,'LINEA VERDACE',1,1,'C',true);
$pdf->SetXY(185,20);
$pdf->Cell(20,4,'KANLUX',1,1,'C',true);
/*$pdf->SetXY(83,10);
$pdf->Cell(20,4,'LINEA VERDACE',1,1,'C',true);
$pdf->SetXY(43,15);
$pdf->Cell(20,4,'KANLUX',1,1,'C',true);
$pdf->SetXY(54,20);
$pdf->Cell(20,4,'PAULMAN',1,1,'C',true);
$pdf->SetXY(52,25);
$pdf->Cell(20,4,'NAEVE',1,1,'C',true);
$pdf->Cell(20,4,'PAULMAN',1,1,'C',true);
$pdf->SetXY(52,25);
$pdf->Cell(20,4,'SLV',1,1,'C',true);
/***/
	}
	$pdf->SetFont('Arial','B',9);
	$pdf->SetTextColor(0,0,0);
	$pdf->SetLineWidth(0.05);
$pdf->Ln(1);
$pdf->SetDrawColor(0,80,180);
$pdf->SetFillColor(221,221,221);
$pdf->SetXY(110,40);
$pdf->SetFont('Arial','B',6);
$pdf->Cell(25,4,'Client:',1,0,'C',true);
 
$pdf->Cell(40,4,$row1[8],1,0,'C');
$pdf->SetXY(110,45);
$pdf->Cell(25,4,'Date:',1,0,'C',true);
$ref = "Référence" ;
$ref = utf8_decode($ref);
$mat = "Votre CDE Matériel";
$mat = utf8_decode($mat);
$pdf->Cell(40,4,$row1[9],1,0,'C');
$pdf->SetXY(25,40);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(35,4,''.$ref.' de l\'affaire',1,0,'C',true);
$pdf->SetFont('Arial','B',6);
$pdf->SetXY(25,45);
$pdf->Cell(25,4,''.$mat.':',1,0,'C',true);
$pdf->Cell(40,4,'',1,0,'C');
$pdf->SetXY(25,50);
$pdf->Cell(25,4,'Notre Dossier:',1,0,'C',true);
$pdf->Cell(40,4,'',1,0,'C');
$pdf->SetXY(25,55);
$pdf->Cell(25,4,'Correspondant:',1,0,'C',true);
$pdf->Cell(40,4,'',1,0,'C');
$pdf->Ln(20);
$qte="Qté";
$qte = utf8_decode($qte);
	$pdf->SetX(5);
	$pdf->SetFillColor(200,200,200);
	$pdf->SetFont('Arial','B',8);
	$pdf->Cell(35,4,'Image',1,0,'C',true);
	$pdf->SetFont('Arial','B',8);
$pdf->Cell(20,4,'REFERENCE',1,0,'C',true);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(65,4,'DESIGNATION',1,0,'C',true);
$pdf->Cell(10,4,$qte,1,0,'C',true);
$pdf->Cell(10,4,'Colis',1,0,'C',true);
$pdf->Cell(15,4,'Remise',1,0,'C',true);
$pdf->Cell(15,4,'TARIF',1,0,'C',true);
$pdf->Cell(15,4,'PU NET',1,0,'C',true);
$pdf->Cell(15,4,'TOTAL',1,0,'C',true);
 
$pdf->Ln(4);
$montant_total = 0;
$i = 20;
while($row1){
	$montant_total = round(($montant_total+$row1[7]),2);
	$designation=utf8_decode($row1[1]);
	$imageUrl = 'images/'.$row1[0].'.jpg';
	/// $pdf->Image($imageUrl,5,0, 15, 10);
 
$pdf->SetX(5);
 
$pdf->Cell(35,20, $pdf->Image($imageUrl,9,60+$i, 20, 17),1,0,'C');
$pdf->Cell(20,20,$row1[0],1,0,'C');
$pdf->SetFont('Arial','',6);
$pdf->Cell(65,20,$designation,1,0,'L');
$pdf->SetFont('Arial','B',8);
$pdf->Cell(10,20,$row1[2],1,0,'C');
$pdf->Cell(10,20,$row1[3],1,0,'C');
$pdf->Cell(15,20,$row1[4],1,0,'C');
$pdf->Cell(15,20,$row1[5],1,0,'C');
$pdf->Cell(15,20,$row1[6],1,0,'C');
$pdf->Cell(15,20,$row1[7],1,0,'C');
$pdf->Ln(20);
 
 
$row1  = mysql_fetch_row($query1);
$i =$i+20;
 
}
//$i =$i+20;
$pdf->Ln(38);
$pdf->SetXY(150,205);
$pdf->Cell(30,4,'Total(FCFA):',1,0,'C',true);
$pdf->SetXY(185,205);
$pdf->Cell(20,5,$montant_total,1,0,'L');
$pdf->Ln(20);
$pdf->Output();
	?>