Hi everyone,
Here's my problem, I think I have searched everywhere to get the solutions, but I didn't find it...
I have to protect a lot of PDF files with a date expiration protection.
Manually, I open a PDF, I open the "Pages" panel on the left, I right-click the first page, and I add a script on the "open page" trigger. Here's the script:
CheckExpiration() function CheckExpiration() { /*-----START EDIT-----*/ var LastDay = 31 var LastMonth = 12 var LastYear = 2008 /*-----END EDIT-------*/ /* DO NOT EDIT PAST HERE !!! */ var today = new Date(); var myDate=new Date(); LastMonth = LastMonth - 1 myDate.setFullYear(LastYear,LastMonth,LastDay); if (myDate<today) { this.closeDoc(1); app.alert("File has expired",1,0,"Expired"); } }
I save my PDF, and it works.
(I know that if I change the date of my computer, I can open the PDF, but this is not a problem).
Now, the problem, is that I have to make this on thousands files.
Thus, I 've tried to make a batch process, using javascript.
But it appears that I can't treat javascripts for pages, just for the document.
I' ve tried with the code above, it doesn't work. It's normal.
After that, I 've tried another thing:
I opened the PDF file that I have protected manually.
Then, I've been in menu Advanced>Document processing>edit all javascripts
and I 've got this following code:
//------------------------------------------------------------- //-----------------Do not edit the XML tags-------------------- //------------------------------------------------------------- //<Page-Actions> //<ACRO_source>Page1:Page Open:Action1</ACRO_source> //<ACRO_script> /*********** belongs to: Page-Actions:Page1:Page Open:Action1 ***********/ CheckExpiration() function CheckExpiration() { /*-----START EDIT-----*/ var LastDay = 31 var LastMonth = 12 var LastYear = 2009 /*-----END EDIT-------*/ /* DO NOT EDIT PAST HERE !!! */ var today = new Date(); var myDate=new Date(); LastMonth = LastMonth - 1 myDate.setFullYear(LastYear,LastMonth,LastDay); if (myDate<today) { this.closeDoc(1); app.alert("File has expired",1,0,"Expired"); } } //</ACRO_script> //</Page-Actions>
I've tried to apply this code, by the batch processing... and it doesn't work.
I don't know what to try now, if I can put a javascript on the document, which makes the same protection, or if there's another solution.
Thank you if someone can help me.
Djay
George