Question

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

Was it helpful?

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.

OTHER TIPS

Working OK with the filename proposal when using "D" for download. Unfortunately, when using "O" for open, it doesn't suggest using the variable name when saving afterwards, but just proposes the filename.

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