IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[PDF] HTML2pdf et table


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 90
    Points : 55
    Points
    55
    Par défaut [PDF] 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 : 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
     
    <?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

  2. #2
    Membre actif Avatar de BlackSmith
    Inscrit en
    Mars 2008
    Messages
    181
    Détails du profil
    Informations personnelles :
    Âge : 36

    Informations forums :
    Inscription : Mars 2008
    Messages : 181
    Points : 207
    Points
    207
    Par défaut
    Le problème viens du faite que le script ne trouve pas ton image de fond.

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 90
    Points : 55
    Points
    55
    Par défaut
    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>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [AC-2007] archiver des fichiers (PDF) dans une table
    Par Tarro dans le forum Access
    Réponses: 0
    Dernier message: 15/03/2010, 09h05
  2. Inserer un pdf dans une table sql en VB.net
    Par red_one dans le forum VB.NET
    Réponses: 14
    Dernier message: 02/06/2009, 09h16
  3. Insertion de fichiers PDF dans une table MySQL
    Par guipe dans le forum Langage
    Réponses: 1
    Dernier message: 13/05/2009, 18h02
  4. Réponses: 0
    Dernier message: 25/12/2008, 17h44
  5. [MySQL]Inserer fichier pdf dans une table
    Par perlgirl dans le forum Langage SQL
    Réponses: 2
    Dernier message: 29/11/2005, 16h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo