Is there any way to generate PDF in laravel 5.3 by giving any kind of doc as a template and passing an array or JSON as Data to PDF Parser. Currently, I use dompdf plugin, where I have to write HTML code to create the template for PDF.
Asked
Active
Viewed 607 times
0
-
*"any kind of doc as a template"*, what exactly does that mean? dompdf is a HTML to PDF converter. – Lawrence Cherone Dec 01 '17 at 23:19
-
https://packagist.org/packages/elibyy/tcpdf-laravel . . . – Hexchaimen Dec 02 '17 at 00:06
-
@LawrenceCherone - Let's assume I have to generate a pdf of 10 pages. for that I have to create HTML for those 10 pages, later add PHP code in HTML. Is there some package where I don't have to write HTML, just give a word doc or any other file acting as a template. – Manish Gangwani Dec 03 '17 at 00:39
-
@ManishGangwani Not that im aware of, also if it were possible, you would still need to use placeholders within the word doc file. How you should do it is use a HTML template and then pass your php parameters into it, which render it out to your final HTML which then you pass into the lib to generate the pdf. Dont try and build the HTML everytime, use a view. – Lawrence Cherone Dec 03 '17 at 00:43
-
@LawrenceCherone I agree with you about placeholders. The website I'm building has 550 Documents- each of 4-7 pages long, I want to avoid creating HTML. Another thing is creating Word Doc is easy and less time consuming than HTML. Just looking for a quick solution. – Manish Gangwani Dec 03 '17 at 01:20
-
Then just supply them the word doc or [convert it](https://stackoverflow.com/questions/5538584/convert-word-doc-docx-and-excel-xls-xlsx-to-pdf-with-php) – Lawrence Cherone Dec 03 '17 at 01:23
-
@LawrenceCherone [this](https://stackoverflow.com/questions/5538584/convert-word-doc-docx-and-excel-xls-xlsx-to-pdf-with-php) converts the doc to PDF using PHP, Here I want to take DOC with PHP data and make PDF. – Manish Gangwani Dec 05 '17 at 19:29