Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > PDF
PDF Forum d'entraide sur la gestion dynamique de documents PDF avec PHP. Exemples : PDFLib, eZPdf, PhpToPdf... Avant de poster -> FAQ PDF et Cours PDF
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 20/06/2008, 10h39   #1
Membre à l'essai
 
Inscription : mai 2008
Messages : 87
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 87
Points : 21
Points : 21
Par défaut HTML2pdf et table

Bonjour a tous,
Je tente en ce moment de convertir un page html/php en pdf
J'utilise donc html2pdf qui est un outils qui répondrai exactement a mes attentes.
Héla hélas celui ne fait que des bêtise

Pourtant le code de ma page est le plus simple possible afin d'avoir un résultat impeccable même avec ces précautions la page s'affiche mal : s

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
 
<?php
 	ob_start();
?>
<page>
<table width="760" height="1126" border=0 style="background:url(../../../images/bdc3.jpg);"> 
<tr>
  <td valign="top">
 
                      <table border=0 width=760 height=112>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=20>
                        <tr>
                          <td width=590>&nbsp;
                          </td>
                          <td>bbbb
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=30>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=75>
                        <tr>
                          <td width=355>&nbsp;
                          </td>
                          <td>bbbbbbbb
                          <br>
                          bbbbb
                          <br>
                          bbbb
                          <br>
                          bbbb
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=30>
                        <tr v align="top">
                          <td width="220">&nbsp;
                          </td>
                          <td>bbbbb
                          </td>
                        </tr>
                      </table>  
 
                      <table border=0 width=760 height=55>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=42>
                        <tr>
                          <td width=5>&nbsp;
                          </td>
                          <td>bbbbb
                          </td>
                        </tr>
                      </table>
 
                        <table border=0 width=760 height=30>
                        <tr>
                          <td width=195>&nbsp;
                          </td>
                          <td><span style="margin-left:25px;">bbbbbb</span>
                              <br>
                              bbbbbb
                          </td>
                        </tr>
                      </table> 
 
                      <table border=0 width=760 height=70>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <TABLE border=0 height="350" width=760>
                      <TR valign="top">
                        <TD width=80>bbbb</TD>
                        <TD width=310>bbbbb</TD>
                        <TD width=72>bbbbbb</TD>
                        <TD width=82>bbbbbb</TD>
                        <TD width=82>bbbbb</TD>
                      </TR>
                      </table>
 
                      <table border=0 width=760 height=0>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=0>
                        <tr>
                          <td width=660>&nbsp;
                          </td>
                          <td>bbbbbbbb
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=40>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=25>
                        <tr>
                          <td width="242">bbbbbb
                          </td>
                          <td width="245">bbbbbb
                          </td>
                          <td>bbbbbbb
                          </td>
                        </tr>
                      </table>
 
                      <table border=0 width=760 height=165>
                        <tr>
                          <td>&nbsp;
                          </td>
                        </tr>
                      </table>
 
  </td>
</tr>
</table>
</page>
 
<?php
	$content = ob_get_clean();
	require_once(dirname(__FILE__).'/../html2pdf.class.php');
	$pdf = new HTML2PDF('P','A4');
	$pdf->WriteHTML($content, isset($_GET['vuehtml']));
	$pdf->Output(); 
?>
Donc rien de bien complexe dans le code et le résultat en HTML est parfait
petit screen :
La page hTML :
http://img53.imageshack.us/img53/2246/screenle4.jpg
Le resultat en PDF :
http://img57.imageshack.us/img57/7015/screen2pl1.jpg
KiranoO est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/06/2008, 10h41   #2
Membre actif
 
Avatar de BlackSmith
 
Inscription : mars 2008
Messages : 181
Détails du profil
Informations personnelles :
Âge : 24

Informations forums :
Inscription : mars 2008
Messages : 181
Points : 186
Points : 186
Le problème viens du faite que le script ne trouve pas ton image de fond.
BlackSmith est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/06/2008, 10h46   #3
Membre à l'essai
 
Inscription : mai 2008
Messages : 87
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 87
Points : 21
Points : 21
Effectivement sans backgound. Le tableau apparait. Pas tout a fait de la même taille visuel sur le document HTML (ce qui me fait un peu peur) mais il apparait :s. Par contre un <TABLE background="chemin"> sa marche pô . Alors comment mettre le background sachant que la fonction ne gere pas la balise <body>
KiranoO est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h49.


 
 
 
 
Partenaires

Hébergement Web