This is a very bad way of securing the file. The user can overcome it by:
2. Changing the local time on their machine
However, it's up to you to decide if you want to do it, I guess...
The problem might be that you're trying to compare Date objects using
mathematical operators (<=). You should first convert them to a number, like
with the getTime method.
Also, I don't see where you're applying any value to sessione before checking it.
Also, there's something weird going on in this line, but I assume it's just
a problem with the encoding:
Well, the ideal would be like the one in here: http://www.pdfscripting.com/public/100.cfm, but It just doesn't work. I'm really not familiar at all with JS, I'm a designer, not a programmer
myDate.setFullYear(lastYear,lastMonth,lastDay); was the full line
If you'll notice, there it also says that the script can be beaten by anyone
For real protection you will need a DRM solution, which costs thousands of
It's just a question of how well protected the file needs to be against how
much you're willing to spend on it.
You line "myDate.setFullYear(lastYear,lastMonth,lastDay);" only sets the value of the year and ignores the other 2 parameters, because the 'setFullYear()' only has on parameter and uses that 1 value to set the full 4 digit year.
The sample script uses 'var finalDate = new Date("3/20/2009");' so why not just build the final date string value from you variables?
You can use something like 'var finalDate = new Date(lastMonth + "/" + lastDay + "/" + lastYear);' to build the date string from your variables and the strings for the separators.
You have not obtained the value from the date object 'today'.
If you are going to change sample code, you should have the reference material for the language so you can read what the line of code is supposed t do. Then only change one line of code at a time and then observe what happens. In this way you would have to deal with the error from one change. And if you have an error, reread about the property, method, or function you are trying to use is supposed to do.
Do you have any specifics what Adobe changed about the ability to use this.closeDoc()? Beginning in version 9.3.3 all our users get a fatal error that closes Reader / Acrobat. If I comment out that line the error goes away. Unfortunately, we need to close the doc to let our app. know it is time to process the next doc. So all our users had to roll back to version 9.3.2 and hope Adobe corrects this in the next release.
Has anyone found another way to close the doc without throwing the fatal error?
From the Acrobat JS API Reference for the doc closeDoc method
I'm aware of JS API Reference disclaimer on page 277. I am executing it from folder level script. The script hasn't changed in 2 years and worked fine in Adobe versions 7.0 through 9.3.2. It stopped working when Adobe released version 9.3.3.
I can make the script do nothing but
so that there is no reference to the document after it closes. I still get a fatal error:
Expected a dict Object
Followed by Microsoft Error report
Program: C:\Program Files\Adobe\Reader9.0\Reader\Acrord32.exe
-pure virtual function call
Then Reader closes.
All our users have rolled back to Reader 9.3.2 and the problem went away.
I don't believe it is related to the location of the method ...rather something Adobe changed between version 9.3.2 and 9.3.3.
Well it is obvious Adobe has changed the way this action works. It might be part of the long list of vulnerabilities fixed. The most probable detail would be access to a memory location outside of the memory space occupied by an open PDF and from that location being able to run rouge code.
I do not work for Adobe, so if you want very specific information you will probably need to contact Adobe, but I really doubt they will give you the detailed reason.
I found something that may be related; If I execute this.closeDoc(true) from a button's mouse up event on Adobe 9.3.3, it closes correctly with no error.
this.closeDoc(true); is currently being executed from a calculation script in a text field so it happens when the doc is initialized. I tried changing to a validation script and had the same fatal exception.
Perhaps Adobe has restricted the availability of closeDoc and can no longer be called from calculation of validation scripts in version 9.3.3. If so, I am in need of another method to close the doc once it has printed with no user intervention.