These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

PDF date print when form is printed HELP! (Acrobat 9 Pro)

dkerne
Registered: Feb 7 2011
Posts: 5

Folks, I've spent over an hour (!) trying to find an answer to this apparently very, very simple question regarding Acrobat 9 Pro:
 
What sort of JS do I need to use to get the date on which a PDF is printed to appear as a form field in the footer (hidden normally, generated---obviously---whenever the PDF is sent to print).
 
I've inserted a form field (called "Today") into the footer of each applicable page, and I don't know what the right/exact/proper code is to execute a "show the current date whenever this file is printed".
 
I'm assuming that this code is either Custom Validation or Custom Calculation Code---either way, I feel as if I'm thisclose, but cannot close the deal.
 
Thanks in advance for your help. Novices like me really, really appreciate it!

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You need to add some JavaScript code to a document action called "Will Print", ("Advanced => Document Processing => Set Document Actions => Will Print").// add formatted current date to field 'Today'
this.getField("Today").value = util.printd("MMM D, YYYY", new Date());

You can set the "Today" field to print only and add a script to the "Did Print" action to clear the field after printing.

George Kaiser

dkerne
Registered: Feb 7 2011
Posts: 5
George/others,

Thanks for the reply, and apologies for not thanking you sooner.

After reading this and other similar posts elsewhere on this site, I can't understand why fairly intelligent people (and, yes, I'm including myself in this group) can't quite square this circle without much angst and trial and error-type effort.

I still can't get this to "work" the way I need it to work, so I figure a very explicit, step-by-step description of what I've done will help those kind enough to try to help.

Okay, I've created a Text Form Field (name: Today), which I've inserted into the first page of my PDF, duplicated it through the rest of the file.

I've gone to the Will Print feature as George suggested above, and entered the exact text that appears between the two rows of asterisks that appear below.

****************************************************************************************************************

this.getField("Today").value = util.printd("MMM D, YYYY", new Date());

*****************************************************************************************************************

The only text that appears in the Today field when I send the PDF to print is D,YYYY. I'm confused as heck at this, as D,YYYY does not appear anywhere in the Text Field Properties dialog box (i.e., With the exception of having "Today" appear in the Name window and having selected "Hidden but Printable" in Common Properties on the General tab, I've not entered a value or selected a value from a drop-down menu).

Also, I tried to delete the code that I entered into the Will Print action, and I can't figure out how to do that, either (i.e., Acrobat "won't let me" delete the code/leave it undefined/remove the "green light" that appears in the Document Actions dialog box.

I'm fit to be tied, to be honest with you.


gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
My error.

The format string for the date should be "mmm dd, yyyy". The uppercase "M" is for minutes and the "D" and "Y" have no meaning.

this.getField("Today").value = util.printed("mmm d,yyyy", new Date());

Unfortunately LiveCycle Designer and Acrobat JavaScirpt do not use the sane syntax for date and time formats.

George Kaiser

dkerne
Registered: Feb 7 2011
Posts: 5
George, thanks for the replies...quick note: your code was 99.0% correct, as you inadvertently placed an "e" in the "util printd" command.

No worries, I (eventually) figured it out. Thanks, again, for your help.
twesner
Registered: Jun 21 2011
Posts: 19
Hi,

I think I have a similar problem. I have a PDF of a textbook that I wrote. I don't know what the original software was that created the material, but I had the company download the book in PDF. This was in 2004 if that makes any difference.

I had the company, now out of business, download the 2 versions of the textbook. One is the student version and the other is annotated instructor's edition (AIE). In the AIE version, some of the pages do not show the annotations, which are for the most part answers in the exercise sets.

When I use Examine Document and view Hidden text > Show preview > Show both hidden and visible text, the page is shown the way the AIE should be other than color. What I would like to do is to save a copy of the AIE that show the hidden text when it is opened and will also print the hidden text.There are no layers and I have tried some different commands in preflight, but have not been successful. I could use some guidance on how to make the hidden show and stay shown.

If you would like to view a sample of the PDF that I am referring to, you can go to http://bjkp.com > eBooks and download the sample. Page 54 of the sample material would be a good example to look at. The document is not locked.Thanks, Terry

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
I see a number of annotation by "Administrator" but there is no visible content to the annotations. There are also link annotations that goto the answer page.

Do know what the authoring program was that created this PDF?



George Kaiser

twesner
Registered: Jun 21 2011
Posts: 19
I don't know what the original program was.

I can use the Object Select Tool with Ctrl+A, that shows the fields and then I can hit Delete to remove them. This shows the AIE text and I can use the TouchUp Object tool to cut the buttons. Unfortunately, this doesn't work on all pages. Sometimes the fields covering the AIE material don't show up and cannot be deleted.

I just assumed if I could see it when I examined the document, I could show the text.


twesner
Registered: Jun 21 2011
Posts: 19
Hi,

This is what I have so far. Below are a few fixes that work on some of the pages. These fixes may be all that someone reading this thread needs. I can fix the documents in the section on http://bjkp.com labeled eBooks, but the documents in the sections Educational Software and Print Textbooks will not work with any of these methods. I can see the AIE text material, but I cannot show it. Does anyone have a fix for those pages?

The most perplexing pages are clean looking text in the Print Textbooks section. They have no buttons and, as with the others, the AIE is hidden below. You can go to http://bjkp.com > Print Textbooks > Elementary Algebra 4th Edition with Applications > El Alg 4th Textbook. Three examples to look at would be page 54 (78 of 208), 103 (127 of 208), or 127 (151 of 208). The document is not locked.You can also go to http://bjkp.com > Educational Software > Educational Software and download the sample entitled Beginning Algebra 5.0 Chapter 3. Two examples to look at would be page 206 (22 of 46) or 215 (31 of 46). The document is not locked. If you can get the AIE to show in the Print Textbooks section, I think the same steps would work for the Educational Software section. In fact, if you can get the print section to work, I would not need to use the Educational Software to make an AIE version.Some methods that work on the eBook section are:

Method 1 – In my situation, the AIE materials are covered with white-filled empty text annotations - so if I print the file with "Document" instead of "Document and markups" selected on the print dialog, the AIE materials all appear. If when I go to print, I change from a printer to Adobe PDF, the file is saved without the white boxes and the AIE showing.

Alternate to method 1 – The 'hidden' text is actually text with visible font that is masked by a white filled text box (a text box that has no text). Text boxes are comments. Open the comments panel where you may examine, sort, show (filter), search and delete any or all comments. If the goal is to delete all masking comments, with careful sorting and filtering you can identify and select the masking comments. You can delete them one by one or by subsets or by all at once. With a ctrl+a plus delete, you can select and delete all filtered and displayed comments. You will need to experiment and get the hang of filtering and sorting masking comments for deletion.

Alternate to method 1 – A fix that works on some of the pages is to select the Object Select Tool > Ctrl+A the fields get selected > delete, and then use the TouchUp Object tool to delete the buttons. Unfortunately, this only works on some of the pages.Method 2 – To remove all the annots from the PDF, use Preflight > single fixups > search for "annot" to pull up the "remove all annotations" fixup, and run it. This will also remove buttons and links, but you can create a new Profile that only reacts to text annotation types if you need to.Best regards, Terry

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Terry, there's no need to post every update on multiple threads. Focus on one and let the other ones be.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Pinksparkle
Registered: Oct 10 2011
Posts: 1
Hello, hope you can help! This script worked for me (I am completely inexperienced in javascript!). But what is the exact script you need to add to the "Did Print" action to clear the field after printing?

Also say I wanted to add an disposal date of 24 hours from the date of printing...how would I do that (step by step would be very very helpful for a non javascript user like me!!!)

I have adobe acrobat prof 7.0.

Thank you!!!