[thelist] Solution for PHP modifying PDF?

Max Schwanekamp lists at neptunewebworks.com
Fri Feb 9 13:17:09 CST 2007

I'm look for a server-side solution to modify existing pdf documents 
on-the-fly via my php app.  Right now we use fpdf[0] to generate new pdf 
docs (works great and it's free), but fpdf does not allow modifying 
existing docs.  Fpdi[1] seems to be what I'm after, but so far it seems 
to be aimed more at using a page of an existing pdf doc as a template.  
What I want is to apply a watermark/custom footer to every page of a pdf 
doc, and be able to set the pdf security/options settings.

The background: My client's site makes available pdf articles for free 
download.  As a discouragement against competitors coming and just 
downloading all the articles and using them on their own sites, my 
client stamps a footer on every page of each pdf doc with a brief 
advertisement for his own site (and if a competitor should distribute 
the pdf file, it will have an ad for my client's site right in it).  
Right now he does this by hand, using Adobe Acrobat.  So far that's been 
fine because it's just once per article every few days.  However, due to 
a new partnership agreement with another organization, we now have a 
need to use two different footers according to the domain context.  Yes, 
we can just go ahead and hand-stamp 350 articles again with the new 
footer, but that just rubs me the wrong way.  What about when we need to 
do it all again for another partner organization?

The solution criteria are:
* Able to run server-side via php.  It could be a command line script 
that runs via a system() command if need be, but an actual php API would 
* Must be able to programmatically apply a custom footer and/or 
watermark to every page of an existing pdf document.
* Must be able to set the "rights" options, esp the "modify","print" and 
"annot-forms" options.
* It would be nice if it would allow prepending the document with a new 
page, but that's not necessary.


Max Schwanekamp

More information about the thelist mailing list