views:

79

answers:

1

Hi all,

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:

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

A: 

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.

timdev
Watch out about FPDI. It has many hidden costs if you want to work with PDFs that has been made with recent Adobe tools. The commercial version costs 100$ and it requires Zend Guard that cost 600 Euro per year. I just got burned by this. Consider avoiding FPDI.
neoneye