How to download a report in the browser

0

Use dompdf, the problem is that it shows all the pdf content in the browser, what I want is that from a button download directly download it to the client's PC.

    
asked by Gotoxy 27.08.2018 в 16:40
source

1 answer

0

You have to add the corresponding headers in your PHP file:

<?php
    header('Content-Description: File Transfer');
    header("Content-type: application/pdf");
    header('Content-Disposition: inline; filename=el_nombre_de_mi_archivo.pdf');
    readfile('file/el_nombre_de_mi_archivo.pdf');
?>

Greetings!

    
answered by 27.08.2018 / 18:44
source