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

automatic date printed acrobat 8 standard

jenkreitl10
Registered: Jun 20 2007
Posts: 14

Dear Expert,
I have been trying very hard to figure out how to print the current date automatically on PDF documents using Adobe Acrobat 8 Standard version. I have tried using adobe help and researched how to do it and I have run out of options of getting this task done. If you could please help me, I would really appreciate it! Thanks, Ginger

My Product Information:
Acrobat Standard 8, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Ginger,

Adding form fields, stamps, watermarks and such are not a feature of Acrobat Standard- you will need Acrobat Professional to add the current date to your PDFs. Here is a link to a pretty good comparison matrix of what is offered in the Acrobat family of products.

[url=http://www.adobe.com/products/acrobat/pdfs/acrobat8_matrix.pdf]http://www.adobe.com/products/acrobat/pdfs/acrobat8_matrix.pdf[/url]

Hope that helps,

Dimitri
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]
fawadafr
Registered: May 12 2008
Posts: 7
Hi Dimitri,

I also have the same problem as Ginger describled. I do have Adobe 8 Professional Edition. How can do this with Adobe 8 Pro?

Thank you,

Fawad Rashidi
Web Developer
www.fawadafr.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You can add a field to the PDF and then set the value of the field to the current date by use of the "Will Print" PDF document action. But you will need to add this code to each PDF either manually or through a Batch Process. Further, if any of your users have Reader, the field in the PDF needs to exist before the PDF is opened as Reader can not create a field on the fly unless the PDF has had extended reader form rights applied to the PDF.

George Kaiser

fawadafr
Registered: May 12 2008
Posts: 7
Hello gkaiseril,

Thank you very much for your feedback. I understand that I need to create a form field on every page of my pdf file. I then need to assign a value to it.

Can you please tell me how to assign value? Do I need to add any custom JavaScript source codes?


Thank you,

Fawad Rashidi
Web Developer
www.fawadafr.com

redcrew
Registered: Nov 7 2006
Posts: 83
Hi,

I have the same question regarding the date field. How do I assign value?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
With AcroForms and using a text field with a format of "None":

this.calculate = false; // turn off calculation for speed
// assign the current date to the field with a format of MMM DD, YYYY
// to the default value so if the form is reset the date will always display
this.getField("MyDateFieldName").defaultValue = util.printd("mmm dd, yyyy", new Date());
// assign default value to the field display value
this.getField("MyDateFieldName").value = this.getField("MyDateFieldName").defaultValue;
this.calculate = true; // restore automatic calculations

This code can be placed in the "Will Print", "Page Open", or "Document Level" JavaScript.

George Kaiser

fawadafr
Registered: May 12 2008
Posts: 7
Hi gkaiseril,

Thank you very much for your help. Your script works just fine but I still have a minor problem. When I set security to PDF, your script doesn't run. The only security I set to my document is prventing unauthroized edit or save. I don't have any special security set.

Why your script doesn't run when I set this security to my PDF file?

Thank you,

Fawad Rashidi
Web Developer
www.fawadafr.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You may have also set the security to not allow updating of form fields. You need to allow the filling of foms. To prevent the date from being modified, you can make the date field read only. You could also make the field hidden but printable so a user would not veiw the print date field but it would magically appear on the printout.

George Kaiser

fawadafr
Registered: May 12 2008
Posts: 7
Thank you very much for your help. It works just fine now.

Fawad Rashidi
Web Developer
www.fawadafr.com

michaelm
Registered: Mar 17 2011
Posts: 1
How do you set up a Batch Process to inbed a dynamic date stamp and message onto a PDF? A message like "This printout will expire EOB 'date'.". I am using Acrobat 9 Pro.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Are you really sure you want to use a stamp?

A stamp is an annotation and when a PDF is printed, including the annotations is an option.

Look at Using batch processing in Acrobat by Tim Plumber for an example of using the batch processor in Acrobat 9.You will have to edit a script for adding the field and for adding the script to the 'Will Print' action.

There are a number of post about the code to add a field and insert the needed script for the will print action.

There are also examples in the Acrobat JS API Reference.
.
You will have to navigate to the 'addField' and 'setAction' methods under JavaScript for Acrobat API Reference => JavaScirpt API => Doc => Methods => addField/setAction.

George Kaiser

hazeldazel
Registered: Mar 28 2011
Posts: 1
Here is the script I use, when the users print the document a script appears at the bottom stating: "For Reference Use Only! Document Valid on Date Printed. Printed on: dd-mmm-yy" You need Acrobat Pro for batch processing, set security to only allow filling in forms. The batch process is "execute javascript".




var myTextSize = 20;
var inch = 72;
var fptr; // Pointer to the field object.
var aRect;

// Get a pointer to the PrintField to see if it exists.
fptr = this.getField("PrintField");
if ( fptr != null ) {
this.removeField("PrintField"); // Note: removeField removes from all pages.
} // if

// Cycle through each page of the current document and create/modify the PrintField.
for (var p = 0; p < this.numPages; p++) {
// Obtain the crop area of the current page.
aRect = this.getPageBox( {nPage: p} );

// Modify the returned rectangle to the desired position of the PrintField.
aRect[1] = Math.round(0.4 * inch) + (2 * myTextSize);

// Create a new PrintField in the new location.
fptr = this.addField("PrintField", "text", p, aRect);

// Set the properties of the PrintField.
fptr.alignment = "center";
fptr.display = display.noView;
fptr.multiline = true;
fptr.readonly = true;
fptr.textColor = color.ltGray;
fptr.textFont = font.Helv;
fptr.textSize = myTextSize;

} // for

// this = document
this.setAction({cTrigger: "WillPrint", cScript: "var fld = this.getField(\"PrintField\"); fld.value = \"For Reference Use Only! \\rDocument Valid on Date Printed. Printed on: \" + util.printd(\"dd mmm yy\", new Date()); \r"});

jasaussie
Registered: Feb 8 2011
Posts: 8
hazeldazel

What your script does is exactly what I need to accomplish for all the avaiation manuals I process. However, I'm a complete novice at any type of scripting. Can you give me step by step from the very beginning of how I use this script with my manuals?

Thanks/jasaussie

jasaussie

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Look at the links in my post for information about using the Batch process, in Acrobat X the batch processor has been renamed to 'Actions' and moved to the "Tool" well and "File" option of the menu bar.

George Kaiser

Needinfo
Registered: Nov 9 2011
Posts: 1
Dear all

We have a weird problem when using a data field in our PDFs:

We use a master file which contains a text field displaying the current date.
We copy this field to our freshly generated PDFs.

But if my colleague and I transfer the field like this (we have Acrobat 8.1 Professional), the field does only show the date when we have copied in the field when the PDF is reopened on another day.

If another colleague of ours does the same, the field works as it should in the documents he has generated. I e the field always shows the current date when the document is reopened at a later date.

When comparing the field properties of the respective fields in the PDFs I have made up and the ones in the PDFs our other collegue has prepared, they are exactly identical!

I have already tried to overcome this problem by using George Kaiser's Java script in his reply dated 2008-05-16 in this field. But the same happened again:
When the field is amended with the Java script, the current date is displayed. But whe nlaunching the PDF one day later, still the date ofthe last document update in shown.

I am at the end of my wits. Can anyone help us with a proposition how to find out the error and to overcome this problem?

Thank you all for your contributions, they will be appreciated!

Best regards
Needinfo
try67
Expert
Registered: Oct 30 2008
Posts: 2398
It's not really clear (to me, at least) what is going on, but it might help if you post the code which is not working, and described where it is placed.

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

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
What is the will print action script?

Is the JavaScript preference enabled for the systems?

George Kaiser