Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PDF protection on-the-fly
- Scott Teglasi
August 2, 2005, 4:09 pm
rate this thread
I've been wrestling around with finding a way of password-protecting
existing PDF documents with custom passwords, all on-the-fly, using PHP.
I've found some commercial implementations of doing this, but was
looking for something without a price tag attached to it. :)
I came across the FPDF library, but that only creates PDFs, not modify
existing ones. Further searching around revealed FPDI, a couple of
classes that can read existing PDFs and modify them. However that
didn't give me the security features I was looking for.
Finally, I came across another class, FPDF_Protection, which DOES apply
password-protection as well as encryption for creating PDF documents..
The problem is that there isn't any easy way to marry the two together..
FPDI uses some of its own custom classes (ie FPDI_tpl 'templates'),
and FPDF_Protection is just extended from the FPDF class.
I'm thinking of mashing the two classes together somehow
(FPDF_Protection and FPDI), but if there's an easier way around it.... :)
Has anyone had experience doing this sort of thing? (Password-protecting
existing PDFs on-the-fly) If so, what was your solution?
Re: PDF protection on-the-fly
first be informed that FPDI do not modify any existing documents. It'll
"only" give the posibility to use single pages of an existing document
as a kind of template. The resulting document is a completely new
Some weeks ago I've adapted the FPDF_Protection class to
FPDI_Protection for use with FPDI. You can find it also on the project
homepage of fpdi: http://fpdi.setasign.de in the download section (at
the bottom (-; )
If you want real/direct (and also faster (-;) encryption of existing
documents with up to 128bit we also offer commercial PHP-APIs for PDF
processing. But for sure there's a price attached to it... ;-) You can
see the API here:
If you're interrested in, don't hesitate to contact me.
Doesn't make sense at all... FPDI does NOT modify any PDF! So you'll
never get the possibility to ADD any Content to a pdf with FPDI. So
your currently protected PDF will never be seen by anyone... why did
you protect it? :-) Just use an unprotected PDF as source file and
protect the resulting one with FPDI_Protection.
- » [Nutcracker] Help/tips on how to solve a cusomer/order issue
- — Previous thread in » PHP Scripting Forum