I want to calculate the future date from todays date plus x number of days. Never having used Java Script before what steps do I follow to incorporate the calculation into the PDF Document. When I attach the PDF Document to an email I don't want the field to be updated for the recipient but remain effectively at the original date. It represents the expiry date on a Membership Card and we don't want it to change each time the recipients opens the attachment.
So when do you want it to update, exactly? If only once then you can just fill it in manually. If you want to do it using a script you can run it from the JS Console, for example.
When a new member joins our organisation they are sent an email with the temporary memberhip card attached. The cardhas to be good for a number of days (to be determined) before they receive their annual membership card. I can do it manually but that means each day I have to update the expiry date (todays date plus x number of days). Can Java Script each day do this calculation automatically and ensure it can't be changed when new member opens the attachment
No, it can't do it by itself. Something has to trigger it, such as opening the file, or pressing a button, or something like that.
Not sure what you mean but of course the new member has to open the file to see and print their temprary membership card. I need someone to produce the java script.
But you said you didn't want that to cause the field to update. So the question is, what should?
Member Smith opens the attachment on 22 October and for example the expiry date is 27 October. Member Smith opend the attachment on 23 October it still says the expiry date is 27 October. He opens it on 24 October it still says 27 October and so on.
Member Jones also opens the attachment on 22 October and has the same experience as Member Jones
Member Harry opens the attachment on 23 October with an expiry date now 28 October (future date is 5 days in advance of todays date). Member Harry still sees 28 October as the expiry date each time he opens the attachment.
I'm sorry, but that doesn't answer my question. I know when it shouldn't be updated. The question is, when should it? And how? Just sending the file can't do that. It has to either be opened (so the script can execute) or otherwise edited with an external tool before being sent.
If you open the file in Acrobat and email it from there then it could be possible, as long as you don't overwrite the local file, or at least save it under a new name.
This is the process. When a member joins the system automatically sends a welcome email. Attached to this email will be the membership card. When received by the member it will be opened. That is the first time the attachment is opened giving the correct expiry date as mentioned before. I have no understanding of Java Script and Adobe Acrobat Pro for this application. I am looking if possible for someone to produce a PDF File that when opened by the Member would produce the expiry date desired. If this is not possible or the member opening the file has to also have Java Script installed and Adobe Acrobat Pro then it is a non starter and I will do it manually which I can do and proven it works.
But why would the member opening it be different from YOU opening it? What if they don't save it, but open the attachment again, starting the whole process again? Certainly this won't work if it's based on the member doing it, because it might not be saved. It HAS to be done before sending.
Exactly. It has to be done either on the server (not using Acrobat), or by someone manually. If you send a file with a script to populate the field and the user doesn't save it, it will display a different date each time they open it, defeating the purpose.
Thank you for taking the time to look at the problem
Ideally, the server script that sends the PDF should be setting the date on the card. This ensures the date is set properly and cannot be changed by the user. This requires purchasing a tool or paying for some development.
You are thinking that a script on the PDF could solve this problem easily with little expense? This is only partially true.
The second problem was outlined by Try67, you need a one time trigger to run the date script. If the trigger is repeated, the date will be updated every time the trigger is hit.
Both of these issues can be solved. The trigger issue can be partially solved by using the state of the expiration date field to decide whether or not to set the date. But this is weak solution because it only works if the user saves the PDF with the date set.