Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

PHP TCPDF unwanted blank page inside HTML markup

$
0
0

I try to generate some text information in TCPDF using writeHTML method. But TCPDF sometimes creates extra blank page after automatic pagebreak inside table structure (I use table associated tags to format text positions).

Bug example screenshot:

Bug example screenshot

UPDATE: Here is the simplified code example:

<?php
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); 
$pdf->SetMargins('20', '20', '15');
$pdf->SetAutoPageBreak(true, '25');  
$pdf->SetFont('freeserif', '', 11);  
$pdf->AddPage(); 
$tagvs = array(           
    'p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 1, 'n' => 1)),
    'ul' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 1, 'n' => 1)),
    'ol' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 1, 'n' => 1)),   
    'div' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 0.0001, 'n' => 1)),
    'hr' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 0.0001, 'n' => 1)),
);
$pdf->setHtmlVSpace($tagvs);
$html = '<p>Some Content</p><table><tbody><tr><td>Some content</td><td>Some content</td></tr>';
//READ NEXT LINE PLEASE
$html .= '<tr><td>BEFORE THIS TR COULD BE BLANK PAGE IN GENERATED PDF</td><td>IT DEPENDS OF TABLE CONTENT LENGTH</td></tr>';
//READ PREVIOUS LINE PLEASE
$html .= '<tr><td>Some content</td><td>Some content</td></tr></tbody></table><p>Some Content</p><p>Some Content</p>';   
$pdf->writeHTML($html, true, false, true, false, ''); 
$pdf->Output('document.pdf', 'I');
?>

UPDATE: More demonstrative screenshot: Table cell is going to the end of the page

How can I avoid it? Many thanks!


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>