PHP

create pdf file of any html page or html code using php

Download the zip file from the following link HTML2PDF.ZIP and run any example to create pdf.

require_once dirname(__FILE__).'/vendor/autoload.php';

use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;

    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf->writeHTML('<h3>hello</h3>');
    $html2pdf->output('example01.pdf');

Advertisement

Did you find this helpful? Share it!

Leave a Comment

Your email address will not be published. Required fields are marked