Précédent   Forum des professionnels en informatique > PHP > Langage > Fichiers
Fichiers Forum d'entraide sur les fichiers avec PHP. Avant de poster -> FAQ fichiers et Sources fichiers
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/01/2011, 04h08   #1
Invité régulier
 
Inscription : octobre 2009
Messages : 25
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations forums :
Inscription : octobre 2009
Messages : 25
Points : 6
Points : 6
Par défaut Double PDF

Bonsoir,
j'utilise la classe fdpf pour crée une facture en pdf, je recupère donc des données via une db, ensuite, je genère le pdf et je l'enregistre dans un dossier sur le server.
A la création du pdf, mon script m'en genère 2 :S, mais pas tout le temps, j'ai bien essayer sans le cache mais rien n'y fait

voici ma page php qui genère mon pdf :

Code :
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
164
165
166
elseif($status_commande == "2")
	{
		/////////////////////////////// generation facture ///////////////////////////////////////
		require('facture/tfpdf.php');
 
		if(isset($_GET['num_commande']))
		{
			$num_commande = $_GET['num_commande'];
			$num_client = $_GET['num_client'];
 
 
			$rep = "facture/facture_all/";
			$dir = opendir($rep);
			$nbr_facture = 0;
			while ($f = readdir($dir)) 
			{
				if(is_file($rep.$f)) 
				{
					$nbr_facture++;
				}
			}
			closedir($dir);
 
			$num_facture = 20110001 + $nbr_facture;
 
			// ajout du numero de facture dans la table commande
			$sql = "UPDATE commande SET num_facture = $num_facture WHERE num_commande = $num_commande";
		    $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
 
			$result_info_commande = mysql_query('SELECT * FROM commande WHERE num_commande = '.$num_commande.'');
			if (!$result_info_commande) 
			{
				die('Impossible d\'exécuter la requête :' . mysql_error());
			}
			$data_commande = mysql_fetch_array($result_info_commande);
 
			$result_info_client = mysql_query('SELECT * FROM client WHERE num_client = '.$num_client.'');
			if (!$result_info_client) 
			{
				die('Impossible d\'exécuter la requête :' . mysql_error());
			}
			$data_client = mysql_fetch_array($result_info_client);
 
			$pdf=new tFPDF();
			$pdf->SetMargins(20,20);
			$pdf->AddPage();
			$pdf->Image('facture/img/logo_print.png',140,20,50);
 
			$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
			$pdf->SetFont('DejaVu','',14);
			$pdf->Cell(85,10,'Facture N° : '.$num_facture.'');
			$pdf->Ln();
 
			$pdf->SetFont('Arial','B',12);
			$pdf->Cell(85,3,'Date: '.$data_commande['date'].'',0,1);
			$pdf->Ln();
 
			$pdf->Cell(85,40);
			$pdf->Ln();
 
			$pdf->SetFont('Arial','B',12);
			$pdf->Cell(85,3,'De  Print',0,1);
			$pdf->Ln();
 
			$pdf->SetFont('DejaVu','',10);
			$pdf->MultiCell(85,5,'45, rue',0,1);
 
 
			$pdf->SetXY(120,77);
			$pdf->SetFont('Arial','B',12);
			$pdf->Cell(85,3,'Client : '.$data_commande['num_client'].'',0,1);
			$pdf->Ln();
 
			$pdf->SetX(120);
			$pdf->SetFont('DejaVu','',10);
			if($data_client["adresse_choisi"] == "0")
			{
			$pdf->MultiCell(85,5,''.$data_client['nom'].' '.$data_client['prenom'].'
'.$data_client["adresse_facturation"].'
'.$data_client["adresse_facturation_2"].'
'.$data_client["codepostal_facturation"].' '.$data_client["ville_facturation"].'
'.$data_client["pays_facturation"].'
Téléphone: '.$data_client['telephone'].'
 
Email: '.$data_client['email'].'
N° de TVA: '.$data_client['tva_facturation'].'',0,1);
			}
			else
			{
				$pdf->MultiCell(85,5,''.$data_client['nom'].' '.$data_client['prenom'].'
'.$data_client["adresse_societe"].'
'.$data_client["adresse_societe_2"].'
'.$data_client["codepostal_societe"].' '.$data_client["ville_societe"].'
'.$data_client["pays_societe"].'
Téléphone: '.$data_client['telephone'].'
 
Email: '.$data_client['email'].'
N° de TVA: '.$data_client['tva_facturation'].'',0,1);
			}
			$pdf->Ln();
 
			$pdf->SetFont('Arial','B',11);
			$pdf->Cell(85,3,'Paiement',0,1);
			$pdf->Ln();
 
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(85,3,'Effectué le '.$data_commande['date'].' a '.$data_commande['heure'].'',0,1);
 
			//titre recap
			$pdf->SetXY(40,156);
			$pdf->SetFont('Arial','',10);
			$pdf->Cell(50,3,'Produit',0,1);
 
			$pdf->SetXY(100,156);
			$pdf->SetFont('Arial','',10);
			$pdf->Cell(50,3,'Description',0,1);
 
			$pdf->SetXY(165,156);
			$pdf->SetFont('Arial','',10);
			$pdf->Cell(50,3,'Prix',0,1);
 
			// ligne 1
			$pdf->Line(20,160,190,160);
 
			// recap
			$pdf->SetXY(30,165);
			$pdf->SetFont('Arial','',10);
			$pdf->Cell(50,3,'Flyers',0,1);
 
			$pdf->SetXY(90,165);
			$pdf->SetFont('DejaVu','',9);
			$pdf->MultiCell(50,4,'Grammage : '.$data_commande['grammage'].'
Format : '.$data_commande['format'].'
Impression : '.$data_commande['impression'].'
Pelliculage : '.$data_commande['pelliculage'].'
Finition : '.$data_commande['finition'].'
Quantité : '.$data_commande['quantite'].'
Livrer en : '.$data_commande['delais'].' jours',0,1);
 
			$pdf->SetXY(160,165);
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(50,3,'125,00 €',0,1);
 
			//ligne 2
			$pdf->Line(20,198,190,198);
 
			$pdf->SetXY(150,205);
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(50,3,'Prix HT : 125,00 €',0,1);
 
			$pdf->SetXY(148,210);
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(50,3,'Prix TTC :',0,1);
 
			$pdf->SetXY(165,210);
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(50,3,'145,00 €',0,1);
 
			//footer
			$pdf->SetY(270);
			$pdf->SetFont('DejaVu','',10);
			$pdf->Cell(170,3,'',0,1,'C');
 
			$pdf->Output('facture/facture_all/Facture-'.$num_facture.'.pdf','F');
			$pdf->Close();
		}
J'utilise la méthode :
Citation:
$pdf->Output('facture/facture_all/Facture-'.$num_facture.'.pdf','F');
pour l'enregsitrement
http://www.fpdf.org/fr/doc/output.htm

Merci d'avance
Rem693 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/01/2011, 08h01   #2
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Quel nom porte le deuxieme ?
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/01/2011, 20h18   #3
Invité régulier
 
Inscription : octobre 2009
Messages : 25
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations forums :
Inscription : octobre 2009
Messages : 25
Points : 6
Points : 6
Par défaut re

Il porte comme nom : 20110002
Rem693 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/01/2011, 20h32   #4
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Ca peut ressembler a un double appel de la page.

Il y avait un bug sournois dans d'anciennes version de firefox.
Quand dans les déclarations CSS, il y avait des choses comme link="", cela provoquait un deuxieme chargement de la page courante.
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/01/2011, 15h47   #5
Invité régulier
 
Inscription : octobre 2009
Messages : 25
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations forums :
Inscription : octobre 2009
Messages : 25
Points : 6
Points : 6
Par défaut re

Effectivement, avec IE aucun problème, mais je n'est pas de link="" ou quelque chose qui fait référence a link dans mes css, je suis sous mozilla firefox 3.6.13
Rem693 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 04h48.


 
 
 
 
Partenaires

Hébergement Web