How to set your pdf expired

How to set your pdf files expired any time you want
by Sando Sasako
Jakarta, 8 June 2017

It is so easy. Very much easy. I got the skill, a very tiny script from https://kbpdfstudio.qoppa.com/?p=5117, it open the whole new experiences.

1. Open the pdf file that you want to set expiration dates
2. Make sure the Pages pane is showing on left side, you can enable it by going to View -> Tabs -> Pages
3. Right click on the first page and select (Page) Properties
4. Choose the Actions tab,
5. Select Trigger: Page Open
6. Select Action: Run A JavaScript
7. Click the Add button


8. Copy this script

function Expire()
{
// Get the current date and time
var rightNow = new Date();
// Set End Date to yyyy, mmm, dd for instance
var endDate = new Date(2017, 12, 13);
if(rightNow.getTime() > endDate)
then
{
app.alert(“This Document has Expired.”);
this.closeDoc();
}
}
Expire();

 


as you set the new Date(2017, 12, 13)
the expiration date is set at 13 January 2018


9. Paste it to the empty space provided


10. Click the close button.


done !

Change your computer date to 14 January 2018.
Open your pdf file.
The pdf file will get opened, voila, accompanied with a small window, saying:
This Document has Expired.


I have been searching this simple and mighty script for decades !!
Finally. Alhamdulillah.
Good to share with the world.

One final word, you need to have Adobe Acrobat or the similar. Not the Acrobat Reader.
I am using Foxit PhantomPDF, Business Edition, Version 7.3.0.118.
Although I have the newer editions. I love this one much better.

Advertisements