Convert Multiple HTML pages to PDF

Asked

Viewed 77 times

1

I am converting html to pdf using html2pdf.
But with the increase in the number of pages this conversion takes a long time.
In my case 24 pages is more than 15 minutes.

Any suggestions on how to convert a large number of pages in a tolerable time ?
Below example of how I am using.

require_once dirname(__FILE__).'/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;
try {
    ob_start();
    include dirname(__FILE__).'/res/exemple00.php';
    $content = ob_get_clean();
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->setDefaultFont('Arial');
    $html2pdf->writeHTML($content);
    $html2pdf->output('exemple00.pdf');
} catch (Html2PdfException $e) {
    $html2pdf->clean();
    $formatter = new ExceptionFormatter($e);
    echo $formatter->getHtmlMessage();
}
  • Young man, how long does a page take in your case? The data is dynamic?

  • 24 dynamically generated pages takes on average 15 minutes

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.