First of all my apologies to all the people who think this question is a repeated one or they find a similar question to this.
I am working on a project in which I have an online form and some PDFs stored on the server.
Functionality
On the submit action I have to get the data from the form, fill it to the copy of PDF and finally download it.
Approach
I followed these steps to achieve this functionality:
- Converted the pdfs to html with this http://www.pdfdownload.org/free-pdf-to-html.aspx online tool.
- Embedded the html with form variables and regenerated the PDFs with this library / dompdf library.
Problem
- The approach is a brute force one as the html generated are far away from the real ones. So lot of effort is wasted in adjusting the html.
- The process is so slow and not reliable as most of the time I get memory error or some other issues.开发者_开发问答
I need to to automate this process. What I have found through searching is I should create an FDF file that contains my variable and pass it to the PDF using some library and then download it.
I am able to create the FDF file but missing any library in PHP (I found one in JAVA) that I can use to create the PDF and download it. One library that I found is pdf tool kit but that is a command line tool and I am not able to use it on the server at run time and download the PDF file.
Anybody having done this before please help.
(Sorry for this long post)
Thanks,
Madhup
Check out FPDI. It allows you to load some existing PDF, draw on it programatically, and output a new PDF. Which, if I read your question right, is what you're trying to do.
There's some example code here.
精彩评论