Reputation: 11
Suppose I have a PDF document on my server, and I want to add certain text (e.g., "This copy is licensed to John Doe and is for personal use only") at the bottom of each page, and then protect the resulting PDF document with a password, generated at run-time. All that is obviously for (a) identifying the copy of a PDF as downloaded by a certain user (who's name is going to be included in that footer I want to add and is, therefore, variable) and (b) adding some (I know, not much, but still) security with a password that is sent to the user separately.
So my question is: what would be the easiest way to accomplish those two tasks in a PHP script? Is it possible to do with free/open source libraries only?
Upvotes: 1
Views: 3644
Reputation: 1322
The PHP script will time out if the PDF is very big. Instead, you could offload the job to a OS-level service running on the server computer.
Upvotes: 0
Reputation: 1402
I'm pretty sure that TCPDF is able to encrypt the PDF. Check this: http://www.tcpdf.org/examples.php. In particular example #16 gives a nice example of protecting a pdf file and to add a custom header/footer.
Upvotes: 2