Hey all,

I'm developing a web app for a school, and among other options I need to generate PDF files from a pdf template, those pdf files must include personal info from clients, so they require to take the values from mysql which is easy to do. However, I don't know how should I do the pdf editing in PHP because using libraries such as pdftk is not an option, the server is not local so I can't really install new libraries OS dependent.

I've been looking for a solution and while at that I became familiar with FDF files, which I've never heard of before. Well, after several attempts, I was able to generate a FDF file but not a personalized PDF file.. the browser points me to the FDF file which I can then open locally with any pdf reader, and then it prompts me to open the pdf file on the server.. and THEN I see the original pdf file with the forms filled...

I've seen websites that generate personalized pdf files on the fly using data stored on database or just from a html form, and that's what I need to do. I think I must find a way to create a new pdf file taking the template pdf and filling it with the FDF file I've just generated.... but how can I do this?

I think there's another way, without using pdf w/ forms, using a pdf as template and having another php library write to the pdf, however this way requires a lot of trial and error since you need to calculate coordinates where the writing would take place, also I've to find a matching font, size and color. This I think would be my least desired option, but I'll consider it in case I can't use pdf with forms.

I've created pdf with forms using adobe acrobat 9 and now I need to populate it on the fly.. how can I do this? Please help me!

btw, I've heard of the zend_pdf library.. maybe I can use this since my server has it installed already... but I can't find any documentation as to how to use it with fdf files.

ThankS!

I like the easy way! HTML2PDF allows you create your output as HTML and then convert that to a PDF. You can initially display the HTML and make sure that you have it right, then feed it to HTML2PDF and a PDF file comes out the other end. It works quite well as long as you are strict about having closing tags for all of your HTML.

Thanks I'll try that.. however, I hate that it's not any HTML file you can convert, you have to follow certain rules like no external css or no use or certain html tags like head, body or html.. I hope it's not as hard as it sounds.

It isn't totally flexible but it's pretty good.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.