I'm using the library PHPWord
to open a Word template has some data that is generated dynamically and result in a Word that the user downloads, my question would be, instead of sending a Word send a PDF of the template generated? And if you can, how would it be?
This is the code I use to launch the Word download.
Thank you.
$filedescargar = "Contrato.docx";
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream; charset=utf-8');
header("Content-Disposition: attachment; filename=".$filedescargar."; charset=utf-8");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($filedescargar));
readfile($filename);