Answer the question
In order to leave comments, you need to log in
How to change the data in docx(word) and then convert to pdf and download the file?
The task is to substitute data into a docx document (from a web form), then convert this word document to pdf and download it to a computer - How to do it all?
I started digging in the direction of phpword - there is either something with the library or something with the server - it is not installed from the composer - I downloaded some ready-made one, it smelled only with lowering the php version to 5.6.
Found an example on the net:
$_doc = new \PhpOffice\PhpWord\TemplateProcessor('Template.docx');
$_doc->setValue('d_num', '10/29-77-Ю'); //номер договора
$_doc->setValue('d_date', '04.10.2014');
$_doc->setValue('last_name', 'тест5');
$_doc->setValue('name', 'тест 6');
$_doc->setValue('surname', 'тест 7');
$_doc->saveAs("dogovor0006.docx");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("new_file.pdf");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question