html - How I can break my document correctly with DOMPDF? -


i want generate pdf dompdf through dynamic content. creating table this:

<?php  $language = $this->input->cookie('language'); if (!isset($language)) {   $language = $core_settings->language; } ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"   "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>   <meta name="author" content=""/>    <meta http-equiv="content-type" content="text/html; charset=utf-8" />   <link rel="stylesheet" href="invoice.css" type="text/css" charset="utf-8" />      <style type="text/css">       @page {         margin: 0;       }       .pages {         margin: .5in;       }       .other-pages{         padding:60px;       }       .first-page {         margin: 0in;         background-color: black;         height: 100%;         width: 100%;         position:absolute;         background-image: url('https://www.example.com/wp-content/uploads/2015/09/example-cover1.jpg');          background-position: bottom center;          background-repeat: no-repeat;          background-size: 100%;        }      .first-page + * {         page-break-before: always;       }       </style>   </head>   <body>     <div class="pages first-page"></div>     <div class="other-pages">         <h2>title</h2>         <div class="round">          <table id="table" class="tablesorter" cellspacing="0">              <thead>              <tr class="header">                <th width="5%">#</th>               <th width="95%">tarea</th>             </tr>              </thead>              <tbody>              <?php $i = 0; $sum = 0; $row=false; ?>               <?php foreach ($tasks $task):?>                 <tr <?php if($row){?>class="even"<?php } ?>>                   <td><?php echo $i; ?></td>                   <td><?php echo $task->name; ?><br><?php echo strip_tags($task->description); ?></td>                 </tr>                <?php $i++; endforeach;  $row = true; ?>             </tbody>          </table>          </div>      </div>   </body> </html> 

when generate pdf have this:

  1. cover page (without margin)
  2. table dynamic content
  3. full blank page (the problem)
  4. table dynamic content (it's same table always)

how can fix blank page?

note: content of table depends of content, height depends of content, cannot supose x fields , break page.

when dompdf splits content across pages duplicates styling on element. means following style copied split element, causing page break:

 .first-page + * {     page-break-before: always;   } 

since want page break after first page use following instead:

 .first-page {     page-break-after: always;   } 

at least 1 issue has been logged related problem: "doubling" of page breaks when page-break-before applied long element


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -