Set expiration date

You wrote some years ago that an expiration date for accessing a PDF document could be enforced. Does this still hold true, and could you make a document available with a sample expiration date?
This would be appreciated.

Herve Cachelin

9 Answers

Voted Best Answer

If ever an user turn off JavaScript he will not be able to use the document, he will just see the layer, or the field, that cover all pages.

And since layers can be locked, I definitely prefer using a layer to a field for making the "mask". ;-)

Of course this is not 100% bulletproof.

By JR Boulay   


If you cannot use a DRM server the usual way is:

  • adding a layer, or a form field, on the top of the page which cover the content.

  • adding a startup JavaScript that hide the layer if it is opened before the expiration date.

This will also prevent the use of the PDF in a PDF Reader that don't support JavaScript.

I prefer the layer tip (vs form field) because the layer state is not saved when the user saves the PDF (unlike the visibility of a form field), so it remains "protected" forever.

JR Boulay   

Yes, but as noted you need to select a method like the DRM service or JavaScript.

And if JavsScript how you are going to control access.

Users can turn off JavaScript so you need to allow for this situation.

George Kaiser   

Thanks for your answer. This will do the trick, as this protection is used within a mature students setting where I don't expect that too many will want to bother about finding out a way to bypass the protection.

Could I stretch your kindness by asking for a sample JS code, i.e. unhiding the blank layer while the expiration date is not reached.

As we are talking about a 150 page document, does each page need its own blank layer - and therefore the layer be unhid for each page individually?

Herve Cachelin   

Add a document level script:

var oDateTrigger = new Date("11/20/2016");
var oToday = new Date();
if(oToday > oDateTrigger)
// Do something…

JR Boulay   

As we are talking about a 150 page document, does each page need its own blank layer - and therefore the layer be unhid for each page individually?

The easier way is to use the Watermark tool to add the "layer-mask", since a watermark can apply to all pages in one clic.

Then use this script, from the Console or in an Action, to reveal the "Watermark" layer in the layer pane and use it as a standard layer:


JR Boulay   

Beware that form fields always stays on the top of any layer, so they are always visible. This is the only case that makes me use a form field as a mask instead of a layer.

JR Boulay   

Thank you for this.

Just in case you want to earn some further expert points:
The way to bypass this protection would be to set the system date to an earlier date. I think you had addressed this by making JavaScript fetch the date from a web location.

Would you kindly indicate how this is done in JavaScript?

Herve Cachelin   

If an (expert) user wants to bypass this JavaScript, he can anyway. This is mostly an "helper" to avoid the use of outdated documents than a real "protection".

JR Boulay   

Please specify a reason: