Copy link to clipboard
Copied
Can someone please help me with this question? I am using this code to expire the document on a specific day and year. What occurred to me and is the reason I'm asking this question, can this script be modified to expire on a specific day and year but also expire on any date prior and any date passed the specific date. Example, to expire on December 25, 2017. If the user tries to change their computer's calendar to, let's say, 2016 the document would still expire.
This is the script I'm using and works ok, but I'd like to modify it to make it more difficult to bypass even if the user turns off "Enable Javascript" or sets their computer back.
function Expire()
{
// Get the current date and time
var rightNow = new Date();
// Setup End Date
var rightNow = new Date();
var beginDate = new Date("March 21, 2016 06:15:00 AM");
var endDate = new Date("March 31, 2017 1:57:00 PM");
this.closeDoc(true)
}
}
// execute check expiration code
Expire();
Copy link to clipboard
Copied
You can't solve this problem with JavaScript.
The user will still be able to open the document in just about any PDF viewer other than Acrobat or Reader and only in the desktop version of those, the mobile Reader doesn't have closeDoc(). You're going to need some sort of encryption that pings a server for the time before decrypting the document.
Copy link to clipboard
Copied
Look for DRM solution.
Copy link to clipboard
Copied
JavaScript can help you but you need to reverse the method: your document must be usable if and only if JavaScript is enabled.
Example: add a layer or a field that cover all the layout on each page, and make JavaScript hidding it at document opening, so: no JavaScript = no document.
Copy link to clipboard
Copied
But layers can easily be hidden in alternative viewers that don't support JavaScript or when JavaScript is turned off.
Copy link to clipboard
Copied
Sure, it's not bulletproof but it's cheaper than DRM 😉
Copy link to clipboard
Copied
I'm with JR on this one. True DRM is expensive and unwieldy. The OCG solution is cheap, easy, and cracking it is beyond the technical abilities of nearly all users. I have customers that uses this technique with documents they sell. So it really works. I've got a demo file that provides detailed instructions on my site.
However, it does fall in to the category of keeping honest users honest. Rather than preventing malicious users from accessing the PDF. Toward this end the solution can be made stronger by also encrypting the PDF with a self signed certificate from the target user.
I think this is a pretty good combination, blocking OCG Layer and digital certificate encryption.
Copy link to clipboard
Copied
Thom is correct in that the solution does work to keep honest people honest... I just have a far dimmer view of humanity. It really comes down to how secure do you need the security to be.
Copy link to clipboard
Copied
Link to the demo, Thom? Or what section is it in? Thanks!
B
Copy link to clipboard
Copied
Brian, Sorry about the late reply on this one. I don't actually have a public version of the Licensed PDF (Lite Security with OCG) sample. It is at www.pdfscripting.com in the member only downloads.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now