I create a site in which users can fill out applications and other documents. I used a library (PHPWord) to create applications from Word document templates (.docx). All this works normally, the problem is to output the created file to print the printer. Please help me to implement this functionality. And please explain more because I'm still a beginner.
Asked
Active
Viewed 2,503 times
1
-
Suggest you create html view of what is in document and print that. There is no direct way to print a remote file – charlietfl Apr 08 '17 at 13:56
-
If client's browser has microsoft office word extension then you can order to print the document to the extension. Orherwise no way to print docx file directly to printer. You must convert it to html in php side, then print it via javascript document.print() function. – kodmanyagha Apr 08 '17 at 14:01
-
And how to convert docx to html? – Sultanov Apr 08 '17 at 14:01
-
Why do you want to convert the docx? Don't create them in the first place then. The best you can do, use some pdf library and make a pdf. You can easily embed the pdf to your page. Or do as charlietfl suggested, take the inputs provided by the user, create HTML view in the page, the use `window.print()`. see this [question](https://stackoverflow.com/questions/16894683/) – Sourav Ghosh Apr 09 '17 at 07:20
-
Yes, I did: I created pdf with mpdf and it seems as though everything is working fine. Thanks a lot for your help. – Sultanov Apr 12 '17 at 10:41