Q: I want to set an expiration date on a PDF document so that the PDF expires after a certain amount of time and can no longer be open. Is it possible in PDF Studio?
A: There is no concept of expiration date defined in the PDF specifications format. And unless you are using a sophisticated document storage service or a Digital Right Management (DRM) server such as LiveCycle, you can’t really have this level of control over PDF documents.
- Open the document that need to set expiration dates
- Make sure the Pages pane is showing on left side, you can enable it by going to View -> Tabs -> Pages
- Right click on the first page and select Page Properties
- Click Add button
- Copy and paste the following scripts into the box
// Get the current date and time
var rightNow = new Date();
// Set End Date to 11/28/16 for instance
var endDate = new Date(2016, 11, 28);
if(rightNow.getTime() > endDate)
app.alert("This Document has Expired.");
- Click OK and Save the document
- You can test this by changing your system date & time and opening the PDF in Adobe Reader. The popup will display and select OK will close the document. Be careful to revert back to the current date and time!
Note 2: Support for the method “closeDoc” was added in PDF Studio 12 and so the document will close as expected in version 12. In PDF Studio 11 and below, the document will not close, it will remain open.