Copy link to clipboard
Copied
I have pdf document that has a javascript set to allow date to appear when document is printed but hidden when viewing.
ASK: I want to have the words PRINTED ON: appear before the date.
I created a text field and named it TODAY. Selected HIDDEN BUT PRINTABLE in properties.
Then chose: Javascript, document actions, Select document will print, edit, them the following script.
this.getField("TODAY").value = util.printd("mm/dd/yyyy", new Date());
[Email address removed by Moderator]
Copy link to clipboard
Copied
Add
"PRINTED ON: " +
before util.
Copy link to clipboard
Copied
Hello,
This is script I am using and it isn’t working for me. Am I missing something?
this.getField("TODAY").value = "PRINTED ON:" + util.printd("mm/dd/yyyy", new Date());
Thanks!
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
What can you see on the printout.
Copy link to clipboard
Copied
Only the date
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
Looks like that you use the old script.
Copy link to clipboard
Copied
Good morning,
What should the script be? I’m not a user of javascript so not exactly sure what is wrong with my script.
Thanks,
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
Use this:
this.getField("TODAY").value = "PRINTED ON: " + util.printd("mm/dd/yyyy", new Date());
Copy link to clipboard
Copied
No, still not working. Only the date appears without the text. Could it have something to do with the text field named TODAY?
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
No, that's not an issue.
Can you share the file in question (via Dropbox, Google Drive, Adobe Cloud, etc.)? Post the link to it here.
Copy link to clipboard
Copied
Here is the file that contains the text field and javascript on lower right footer.
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
You can't attach files here directly. Share it using a file-sharing website, like I described.
Copy link to clipboard
Copied
Unfortunately I am unable to use dropbox, google drive, etc. due to company security restrictions. I can only email.
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Copy link to clipboard
Copied
You can send it to me to try6767 at gmail.com and I'll check out what's going wrong.
Copy link to clipboard
Copied
Update for those interested: The script worked fine. The issue was that the fields were too small to show the full text.
Resizing them (or changing the font size) solved it.
Copy link to clipboard
Copied
What script do you use at "document will print" ?
Copy link to clipboard
Copied
this.getField("TODAY").value = "PRINTED ON: " + util.printd("mm/dd/yyyy", new Date());
Susan Gionet I Digital Publishing I Graphic Design I 506.648.2215
Irving Paper
435 Bayside Drive
Saint John, NB
E2L 4K9
Find more inspiration, events, and resources on the new Adobe Community
Explore Now