Search code examples
phpdatepdfdrm

Generation PDF with PHP including an expiration date


I have to send some text-information from the webserver to the users. Unfortunately, this text have to be destroyed (which means access to the information should be deny) after 7 days. So one idea is to create an pdf with an "expiration date" inside, in order to get an file which is unable to open, after the 7. day. Is this possible with PHP?

But how to start?

I don't need an solution which is 100% safe. The responsibility will be transferred to the user, if he goes an forbidden way to safe, copy or manipulate this document. I hope to find a way, to make the content unreadable (even it is (only) the first impression). But it looks like, there will be no way.


Solution

  • Once the PDF is generated, it cannot be "destroyed". There's no support in PDF for "do not open after 7 days", and such support is ENTIRELY dependent on the pdf viewer app honoring it. Nothing says the user can't reset their system clock back to a date/time that would fall within the PDF's viewing limit anyways.

    PDF's (in)security flags are limited to encrypting the document so it can't be edited, and some flags to SUGGEST to the pd viewer that printing, screen reading, or text scraping should be forbidden. But they're just SUGGESTIONS and the PDF viewer is free to interpret/ignore them any way it wants.

    Ultimately, this security "system" would be useless and trivially bypassed. And since it's browser-based, there is absolutely nothing you can do to control the remote user's machine to prevent the data from being downloaded/cached/saved in some form.