Search code examples
phpmysqlpdf-generationhtml2pdf

PDF name not saved for file generated from HTML2PDF


I am facing a very frustrating problem. I am generating a pdf file with html2pdf and it shows up properly in a popup screen with pdf plugin. When I try to save the file, it is not taking the filename that I have allocated it. It is instead taking the name of the page used to generate the file.

    $html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', array(6,6,6,6));
    $html2pdf->setDefaultFont('Arial');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output($filename.'.pdf');

Your help is much appreciated.

Thanks and regards,

Babu


Solution

  • What html2pdf version? Try $html2pdf->Output($filename.'.pdf', 'D'); to force the download and check the name. Perhaps you could add error_reporting(-1); at the top of the script to check eventual warning.