php - Integration header, content, footer in html2pdf -


i made html page , converted pdf format through library html2pdf.

code :

<?php        require('../admin/html2pdf/html2pdf.class.php');         ob_start(); ?>   <page>      <page_header>  <br> <table>     <tr class="headings"  style="background-color: #ffffff;">              <th class="column-title">home</th>              <th class="column-title"><h3>web site</h3></div></th>              <th class="column-title">home</th>     </tr>                               </table> </page_header>  <page_footer>  <div> <table border = "1" id="table2">     <tr style="background-color: #f2f2f2;">         <th colspan=3 style="width: %;text-align: center;">footer</th>         <th colspan=3 style="width: %;text-align: center">copyright </th>         <th colspan=3 style="width: %;text-align: center">copyright </th>     </tr>     <tr>         <td >test</td> <td>test</td><td>test</td> <td>test</td> <td>test</td> <td>test</td><td>test</td> <td>test</td> <td>test</td>     </tr>  </table> </div> </page_footer>  </page>   **content :**  <div style="" id="table1" class="content">   <table>      <tr class="headings"  style="background-color: #f2f2f2;">                                     <th class="column-title" style="width: 0px">firstname</th>                                     <th class="column-title" style="width: 80px">lastname</th>                                     <th class="column-title" style="width: 80px">mail</th>                                     <th class="column-title" style="width: 80px">phone</th>                                     <th class="column-title" style="width: 80px">login</th>                                     <th class="column-title" style="width: 80px">password</th>                                     <th class="column-title" style="width: 80px">birthday</th>    </tr>                                      <tbody>                                       <tr class="even pointer">                                         <td class=" "><p style="">firstname1</p></td>                                         <td class=" "><p style="">lastname1</p></td>                                         <td class=" "><p style="">mail1</p></td>                                         <td class=" "><p style="">phone1</p></td>                                         <td class=" "><p style="">login1</p></td>                                         <td class=" "><p style="">password1</p></td>                                         <td class=" "><p style="">birthday1</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname2</p></td>                                         <td class=" "><p style="">lastname2</p></td>                                         <td class=" "><p style="">mail2</p></td>                                         <td class=" "><p style="">phone2</p></td>                                         <td class=" "><p style="">login2</p></td>                                         <td class=" "><p style="">password2</p></td>                                         <td class=" "><p style="">birthday2</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname3</p></td>                                         <td class=" "><p style="">lastname3</p></td>                                         <td class=" "><p style="">mail3</p></td>                                         <td class=" "><p style="">phone3</p></td>                                         <td class=" "><p style="">login3</p></td>                                         <td class=" "><p style="">password3</p></td>                                         <td class=" "><p style="">birthday3</p></td>                                       </tr>                              <tr class="even pointer">                                         <td class=" "><p style="">firstname4</p></td>                                         <td class=" "><p style="">lastname4</p></td>                                         <td class=" "><p style="">mail4</p></td>                                         <td class=" "><p style="">phone4</p></td>                                         <td class=" "><p style="">login4</p></td>                                         <td class=" "><p style="">password4</p></td>                                         <td class=" "><p style="">birthday4</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname5</p></td>                                         <td class=" "><p style="">lastname5</p></td>                                         <td class=" "><p style="">mail5</p></td>                                         <td class=" "><p style="">phone5</p></td>                                         <td class=" "><p style="">login5</p></td>                                         <td class=" "><p style="">password5</p></td>                                         <td class=" "><p style="">birthday5</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname6</p></td>                                         <td class=" "><p style="">lastname6</p></td>                                         <td class=" "><p style="">mail6</p></td>                                         <td class=" "><p style="">phone6</p></td>                                         <td class=" "><p style="">login6</p></td>                                         <td class=" "><p style="">password6</p></td>                                         <td class=" "><p style="">birthday6</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname7</p></td>                                         <td class=" "><p style="">lastname7</p></td>                                         <td class=" "><p style="">mail7</p></td>                                         <td class=" "><p style="">phone7</p></td>                                         <td class=" "><p style="">password7</p></td>                                         <td class=" "><p style="">password7</p></td>                                         <td class=" "><p style="">birthday7</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname8</p></td>                                         <td class=" "><p style="">lastname8</p></td>                                         <td class=" "><p style="">mail8</p></td>                                         <td class=" "><p style="">phone8</p></td>                                         <td class=" "><p style="">login8</p></td>                                         <td class=" "><p style="">password8</p></td>                                         <td class=" "><p style="">birthday8</p></td>                                       </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname9</p></td>                                         <td class=" "><p style="">lastname9</p></td>                                         <td class=" "><p style="">mail9</p></td>                                         <td class=" "><p style="">phone9</p></td>                                         <td class=" "><p style="">login9</p></td>                                         <td class=" "><p style="">password9</p></td>                                         <td class=" "><p style="">birthday9</p></td>                               </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname10</p></td>                                         <td class=" "><p style="">lastname10</p></td>                                         <td class=" "><p style="">mail10</p></td>                                         <td class=" "><p style="">phone10</p></td>                                         <td class=" "><p style="">login10</p></td>                                         <td class=" "><p style="">password10</p></td>                                         <td class=" "><p style="">birthday10</p></td>                               </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname11</p></td>                                         <td class=" "><p style="">lastname11</p></td>                                         <td class=" "><p style="">mail11</p></td>                                         <td class=" "><p style="">phone11</p></td>                                         <td class=" "><p style="">login11</p></td>                                         <td class=" "><p style="">password11</p></td>                                         <td class=" "><p style="">birthday11</p></td>                               </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname12</p></td>                                         <td class=" "><p style="">lastname12</p></td>                                         <td class=" "><p style="">mail12</p></td>                                         <td class=" "><p style="">phone12</p></td>                                         <td class=" "><p style="">login12</p></td>                                         <td class=" "><p style="">password12</p></td>                                         <td class=" "><p style="">birthday12</p></td>                               </tr>                               <tr class="even pointer">                                         <td class=" "><p style="">firstname13</p></td>                                         <td class=" "><p style="">lastname13</p></td>                                         <td class=" "><p style="">mail13</p></td>                                         <td class=" "><p style="">phone13</p></td>                                         <td class=" "><p style="">login3</p></td>                                         <td class=" "><p style="">password13</p></td>                                         <td class=" "><p style="">birthday13</p></td>                               </tr>                                         </tbody> </table> </div>  <?php     $content = ob_get_clean(); // récupère tout le contenu depuis ob_start()     // ou $content = ob_get_clean() ça fonctionne également;     $pdf = new html2pdf('p', 'a4', 'fr');     $pdf->pdf->setdisplaymode('fullpage');     $pdf->writehtml($content);      ob_clean();     $pdf->output('test.pdf'); ?> 

it works @ conversion.but problem in data display.there bad organization @ header , footer.as see in picture :

enter image description here

try css

        <style type="text/css">             table { page-break-inside:auto }             tr    { page-break-inside:avoid; page-break-after:auto }             thead { display:table-header-group }             tfoot { display:table-footer-group }         </style> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -