HTML2PDF et les tables :s

Fermé
MuronY Messages postés 47 Date d'inscription vendredi 18 mai 2007 Statut Membre Dernière intervention 27 août 2008 - 20 juin 2008 à 09:30
 spipu - 25 août 2008 à 16:37
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

 
<?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
La page en pdf : :x
http://img57.imageshack.us/img57/7015/screen2pl1.jpg
A voir également:

2 réponses

Vous avez une page PHP non HTML vous ne pouvez pas convertir cette page en PDF ,il faut qu'elle soit en HTML.
en premier vous devez convertir la page PHP en page HTML et puis pensez la convertir en PDF.
SALUTATIONS
0
la nouvelle version 3.10 de html2pdf prend maintenant en compte les background-image.

http://html2pdf.spipu.net/
0