Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modify pdf with php

Status
Not open for further replies.

coderwasp

Programmer
Jan 10, 2007
24
US
I have to write a program that opens up a pdf document and inserts a code somewhere inside the pdf and then saves the file on the server.

Right now the pdf has a line that reads

Your code is ______.

I need it to say your code is 7889. for example.

Anyone know how this could be done?
 
My personal favorite way to do this is to create a form field in the PDF and fill it using FDF data. An FDF has a set of field names (from the PDF) and text to put into each field. You can create an FDF file using forge_fdf, then merge the PDF with its FDF data using Pdftk. Pdftk can also "flatten" the PDF to turn the form fields into areas of locked text. Both are free.
 
I downloaded both programs but I can't seem to figure out how to ude forg_fdf. It is one file forge_fdf.pdf. How do you create an FDF file?
 
courtarro,

I was able to create fdf data, but pdftk is a command line tool. I need something that can run on a linux server and can be launched from a php script.
 
Nearly any command-line application can be launched from a PHP script, and in fact PHP has program execution functions to do just that. It's just a matter of making sure the user as which your PHP scripts run (typically the user as which your web server runs) has permission to run the app and permission to access whatever data the app must use.


Want the best answers? Ask the best questions! TANSTAAFL!
 
Insufficient data for a meaningful answer.

What Linux distribution are you running?
Do you have permission to install software on this server?


Want the best answers? Ask the best questions! TANSTAAFL!
 
I'm not really sure of the version. I was hoping that I can do this without trouble tickets, tech support calls, and headaches.

Let's assume I have permission to install software on the server, can you suggest one of the packages listed? If this is not enough info I can contact the host in the morning, and get back to you then.

thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top