Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How do I add text to an existing pdf file using php?
I have a pdf file that someone else created. It's not copy protected or privileged or anything like that (it's actually a government form). I want to set up a web page where I get info from the user and based on that info, I add various text fields to the pdf file. The pdf file is two pages and all the text I'll be adding will be to the first page.
I've looked at the pdf file and it's not decipherable by human eyes. I've used acrobat to add typewriter text but the stuff it added to the file is also not decipherable by human eyes.
Is there an existing library (or something) that will allow me to open up an existing pdf file (on my webserver), add displayable text to it, then push the resulting pdf file to the user?
3 Answers
- Anonymous1 decade agoFavorite Answer
Good timing for you to ask -- I will need this in the very near future. FPDI looks like it could do what you need and it's Apache licensed.
- 1 decade ago
I had to write this program in high school for the school and it was tough. I may have been over thinking it a bunch, but the only solutions I found for doing something like this was creating the pdf from a template pdf on your server and generating the variables into that template pdf on the server. This actually saved as an .FDF file and I had to write a desktop application that converted the fdf files into pdf. You may find an easier way, but just try to think of things like converting to a different data type, then converting again. It may be a pain but it may be the only solutions.
Note: This was a year ago, things change and technology evolves. As far as I know, there could be a library out there now to do this for you.
try:
- Anonymous7 years ago
FPDF is a great PHP lib to create/update PDF.
If you want to use an existing PDF as template, to generate custom document based on that one plus some user provided data (e.g. from web form), you can use Dhek.
It a graphical free/OpenSource template designer working without altering original PDF, saving template definitions (areas to be written over later) in JSON file.
Such template definition format can used in any language (including PHP) to know where to write user data on original PDF (using PDF lib) in order to generate the final/custom PDF.
You can see online PHP example at https://github.com/applicius/dhek/blob/master/READ... .