I studied wkhtmltopdf, tcpdf mechanism to generate pdf files. wkhtmltopdf where you directly pass a .html file and it gives you the pdf where in tcpdf you need to code entire pdf.
我研究了wkhtmltopdf,tcpdf机制来生成pdf文件。 wkhtmltopdf你直接传递一个.html文件,它给你pdf在tcpdf中你需要编写整个pdf的代码。
my case is I'm having a pdf form template Which I've converted into html so user can fill that form and after i fill that template with user entered values then I'll give an option to user to download the html (user filled) file as PDF document, so template will have user entered data next to that labels.
我的情况是我有一个pdf表单模板我已经转换成html所以用户可以填写该表单,在我用用户输入的值填充该模板后,我会给用户一个选项来下载html(用户填写) )文件作为PDF文档,因此模板将在用户输入的数据旁边输入数据。
so first
PDF template >> convert to .HTML page >> process with php echoing >> convert it back with user input to a PDF file.
I'm confused here which approach I should use.
我很困惑,我应该使用哪种方法。
- Install wkhtmltopdf on server and use it to pass .html page
在服务器上安装wkhtmltopdf并使用它来传递.html页面
problem: Everytime I need to save .html page on server and pass again it to wkhtmltopdf.
问题:每次我需要在服务器上保存.html页面并再次将其传递给wkhtmltopdf。
- using TCPDF I need to write lots of code to create pdf exactly same as template PDF docs I'm having and then using php echoing those user enterted values.
使用TCPDF我需要编写大量代码来创建pdf与我正在使用的模板PDF文档完全相同,然后使用php回显那些用户输入的值。
Which approach should i use If I'm expecting 1000+ users will be saving page as pdf at same time, approach which will be more easier and scalable in future.
我应该使用哪种方法如果我期望1000多名用户同时将页面保存为pdf,将来这种方法将更加容易和可扩展。
1 个解决方案
#1
0
First of all - I think you should go with the HTML form to PDF approach, so that's either wkhtmltopdf or a tool that already does this for you like PDFmyFORM.
首先 - 我认为你应该使用HTML表单到PDF方法,所以这是wkhtmltopdf或已经为你做的工具,如PDFmyFORM。
In case you're expecting to go to 1000 saves concurrently then you definitely want to roll your own solution instead of going with an external service though.
如果您希望同时进行1000次保存,那么您肯定想要推出自己的解决方案而不是使用外部服务。
There are patches in the wkhtmltopdf issue list that suggest caching (see this one) and you may also want to think about whether all these forms have to be generated as PDF again. You could use APC cache to somehow cache PDFs based on the same values being filled in. That could save you a bunch of time.
wkhtmltopdf问题列表中有补丁建议缓存(参见本文),您可能还想考虑是否所有这些表单都必须再次生成为PDF。您可以使用APC缓存以某种方式根据填写的相同值缓存PDF。这可以节省您一大堆时间。
Other solutions you may want to look into are for example PhantomJS, which is a headless webkit browser too, but then based on JS - so that may reduce your server load alltogether...
你可能想要研究的其他解决方案是例如PhantomJS,它也是一个无头webkit浏览器,但后来基于JS - 所以这可能会减少你的服务器负载......
#1
0
First of all - I think you should go with the HTML form to PDF approach, so that's either wkhtmltopdf or a tool that already does this for you like PDFmyFORM.
首先 - 我认为你应该使用HTML表单到PDF方法,所以这是wkhtmltopdf或已经为你做的工具,如PDFmyFORM。
In case you're expecting to go to 1000 saves concurrently then you definitely want to roll your own solution instead of going with an external service though.
如果您希望同时进行1000次保存,那么您肯定想要推出自己的解决方案而不是使用外部服务。
There are patches in the wkhtmltopdf issue list that suggest caching (see this one) and you may also want to think about whether all these forms have to be generated as PDF again. You could use APC cache to somehow cache PDFs based on the same values being filled in. That could save you a bunch of time.
wkhtmltopdf问题列表中有补丁建议缓存(参见本文),您可能还想考虑是否所有这些表单都必须再次生成为PDF。您可以使用APC缓存以某种方式根据填写的相同值缓存PDF。这可以节省您一大堆时间。
Other solutions you may want to look into are for example PhantomJS, which is a headless webkit browser too, but then based on JS - so that may reduce your server load alltogether...
你可能想要研究的其他解决方案是例如PhantomJS,它也是一个无头webkit浏览器,但后来基于JS - 所以这可能会减少你的服务器负载......