Bonjour,
J'ai un tableau tout simple de 160 lignes:
<table>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
...
</table>
Est-ce normal que la création du pdf mette presque 30 secondes ?
<?php // récupération du contenu HTML ob_start(); ?> <table> <?php for($k=0; $k<160; $k++) { ?> <tr> <td><?php echo $k ; ?></td> <td><?php echo 2*$k ; ?></td> <td><?php echo 3*$k ; ?></td> <td><?php echo 4*$k ; ?></td> </tr> <?php } ?> </table> <?php $content = ob_get_clean(); // mode : true = debug, false = normal $mode = true; // conversion HTML => PDF require_once(dirname(__FILE__).'/html2pdf.class.php'); if ($mode) echo HTML2PDFgetTimerDebug(); $html2pdf = new HTML2PDF('P','A4', 'fr'); $html2pdf->WriteHTML($content); $html2pdf->Output('index.pdf', $mode); if ($mode) echo HTML2PDFgetTimerDebug();
Timer : 2.361s - Memory used 1703 Ko
Debug : init
Timer : 6.575s - Memory used 0 Ko
Debug : init
Timer : 6.989s - Memory used 0 Ko
Debug : init
Timer : 7.087s - Memory used 0 Ko
<page backtop="10mm" backbottom="10mm">
<page_header>
<table>
<tr>
<td>A</td>
<td rowspan=2>B</td>
<td>C</td>
</tr>
<tr>
<td>E</td>
<td>F</td>
</tr>
</table>
</page_header>
<div>Titre 1</div>
<div>
<div>Titre 2</div>
<table>
<?php for($k=0; $k<160; $k++) { ?>
<tr>
<td style="width: 55%;"><?php echo $k ; ?></td>
<td style="width: 15%;"><?php echo 2*$k ; ?></td>
<td style="width: 15%;"><?php echo 3*$k ; ?></td>
<td style="width: 15%;"><?php echo 4*$k ; ?></td>
</tr>
<?php } ?>
</table>
</div>
<page_footer>
<table class="footer">
<tr>
<td>23/04/2009</td>
<td>page [[page_cu]]/[[page_nb]]</td>
</tr>
</table>
</page_footer>
</page>
Debug : init
Timer : 14.056s - Memory used 0 Ko