Bonjour,


j'utilise la librairie tfpdf pour générer un pdf contenant, du texte utf8 et une image

et 4 fois sur 5 j'ai cette erreur


Code : Sélectionner tout - Visualiser dans une fenêtre à part
Warning: unpack() [function.unpack]: Type n: not enough input, need 2, have 1 in



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
 
 
 
 
$pdf = new tFPDF();
$pdf->AddPage();
 
// Ajoute une police Unicode (utilise UTF-8)
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',14);
/*
// Charge une chaîne UTF-8 à partir d'un fichier
$txt ="é'(-èç";
$pdf->Write(8,$txt);
 
// Sélectionne une police standard (utilise windows-1252)
$pdf->SetFont('DejaVu','',14);
$pdf->Ln(10);
 
*/
$pdf->Image($_SERVER["DOCUMENT_ROOT"].'/FRONT/XX/media/img/XX_mail_account/image.jpg',10,10,190,100,'');
 
//Set x and y position for the main text, reduce font size and write content
//set font for the entire document
$pdf->SetFont('DejaVu','',15);
$pdf->SetTextColor(0,0,0);
 
$pdf->SetXY (10,120);
$pdf->SetFontSize(10);
$pdf->Write(5,'Cher client ,');
$pdf->Ln(4);
 
$pdf->Write(5,'Nous vous confirmons la reservation suivante :');
$col=0;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
$pdf->Ln(10);
$pdf->SetFont('DejaVu','',10);
$pdf->SetTextColor(0,153,255);
 
$pdf->Write(5,'Coordonnées');
 
 
 
$col=1;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
 
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('DejaVu','',10);
$pdf->Write(5,'Nom : XXX');
$pdf->Ln();
$pdf->Write(5,'Prénom : XXX');
$pdf->Ln();
$pdf->Write(5,'Nméro de téléphone : XXX');
$pdf->Ln();
$pdf->Write(5,'Email :xxx');
$pdf->Ln();
 
 
//MODELE
$col=0;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
 
$pdf->Ln(10);
$pdf->SetFont('DejaVu','',10);
$pdf->SetTextColor(0,153,255);
$pdf->Write(5,'Modèle');
 
 
 
$col=1;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
$pdf->SetTextColor(0,0,0);
 
$pdf->SetFont('DejaVu','',10);
$pdf->Write(5,'XXX ');
$pdf->Ln();
$pdf->Write(5,'Couleur : XXX');
$pdf->Ln();
$pdf->Write(5,'Abonnement : XXX');
$pdf->Ln();
$pdf->Write(5,'Date : '.date("d/m/Y h:m"));
$pdf->Ln();
$pdf->Write(5,'Numéro de réservation : xxx');
$pdf->Ln();
//PAIEMENT
 
$col=0;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
 
$pdf->Ln(10);
$pdf->SetFont('DejaVu','',10);
$pdf->SetTextColor(0,153,255);
$pdf->Write(5,'Paiement');
 
$col=1;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('DejaVu','',10);
$pdf->Write(5,'Numéro de transaction : XXX ');
$pdf->Ln();
$pdf->Write(5,'Nous vous confirmons le maiement suivant (Paiement XXX numéro XXXX)');
$pdf->Ln();
$pdf->Write(5,'Montant total TTC : 100 €');
$pdf->Ln(10);
//conclusion
$col=0;
$x=10+$col*65;
$pdf->SetLeftMargin($x);
$pdf->SetX($x);
 
 
$pdf->SetFont('DejaVu','',10);
 
$pdf->Write(5,'Nous vous recontacterons pour poursuivre cette demarche de reservation à l\'approche ');
 
 
 
$pdf->Ln(10);
 
 
$pdf->Write(8,"ÂÇĞçÖŞşÂÇĞçÖŞşXin chào thế giớiЗдравствулте мирOlá mundoΓειά σου κόσμοςWitaj świecie");
 
 
$pdf->Output('example1.pdf','D');




je ne change rien dans le code et ça refonctionne.
Deuxième chose, fpdf prend t'il les caractères chinois en compte?



Merci d'avance