Question

I am converting html to PDF. All working well except when there is a long html , having multiple pages. After conversion, its output is displayed in one PDF page, i need auto pagination .Is it supported by mPDF. It works well with all other HTML but not with few am working. I tried to copy my code here , but it was very long so cant put here.

My Html is not valid , I know it.I used HTML purifier to fix it, but its not completely fixed. I read in net that if there are nested tables then this may happens. But i need a solution .

Here is my code.

<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors','Off');
//ini_set("pcre.backtrack_limit","1000000");
ini_set("memory_limit","256M"); 
$html = 'My long invalid HTML';


include_once('../htmlpurifier/library/HTMLPurifier.auto.php');
$config = HTMLPurifier_Config::createDefault();
$config->set('Core', 'Encoding', 'UTF-8');
$config->set('HTML', 'Doctype', 'HTML 4.01 Transitional');
$filter = new HTMLPurifier($config);
$html = $filter->purify($html);
include("mpdf.php");
$mpdf=new mPDF('c');
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
Was it helpful?

Solution

The issue is with nested tables. I separated the tables and PDF is now working great

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top