Skip to main content
Participating Frequently
November 1, 2005
Pregunta

Add current date to PDF documents

  • November 1, 2005
  • 127 respuestas
  • 43041 visualizaciones
This doesn't seem like it should be hard, but I have been unable to find information on how to do it.

I have about 100 PDF files. Somewhere on them, I need to display "Date Printed: dd mmm yyyy", and have the current date displayed.

I don't care whether this is placed at the top of the page, the bottom, or opaque in the background.

I would like to be able to accomplish it using the batch command, but will perform manually if necessary.

I have Acrobat 7 Professional.

Can someone please help me out?
    Este tema ha sido cerrado para respuestas.

    127 respuestas

    DimitriM
    Inspiring
    November 11, 2005
    Hi David,

    just to let you know I tried to reply today but your email bounces back- sorry.

    Dimitri
    WindJack Solutions
    www.windjack.com
    Participating Frequently
    November 11, 2005
    Bernd - I don't follow you. Please understand, I am new to Acrobat and Javascript.

    This is the script I am running. Do I need a different script? An additional script? Or does this need to be modified in some way?

    If it needs modifications, please provide examples.

    for (var p = 0; p < this.numPages; p++) {

    var fd = this.addField("Date", "text", p, [72,0, 540,16]);

    fd.textSize=8;

    fd.value = "Document printed on: " + util.printd("dd/mmm/yyyy", new Date());

    fd.allignment = "center";

    fd.fillColor = color.transparent;

    fd.textColor = color.gray; fd.borderColor = color.gray; fd.readonly = true; }
    Bernd Alheit
    Community Expert
    Community Expert
    November 11, 2005
    You can set the field value at the "Document Will Print" event.
    Participating Frequently
    November 11, 2005
    So is it even possible to do what I need to do?
    Bernd Alheit
    Community Expert
    Community Expert
    November 11, 2005
    > Can anyone explain why this script is not producing a dynamic date?

    The script adds the date of the script run.
    Participating Frequently
    November 11, 2005
    Can anyone explain why this script is not producing a dynamic date?

    Is producing a dynamic date even possible? Am I ttrying to do the impossible here?

    for (var p = 0; p < this.numPages; p++) {
    var fd = this.addField("Date", "text", p, [72,0, 540,16]);
    fd.textSize=8;
    fd.value = "Document printed on: " + util.printd("dd/mmm/yyyy", new Date());
    fd.allignment = "center"; fd.fillColor = color.transparent;
    fd.textColor = color.gray;
    fd.borderColor = color.gray;
    fd.readonly = true; }

    Also - the text is not being centered in teh form field, even though the allignment parameter is set to center.
    ReinhardF
    Participating Frequently
    November 11, 2005
    " Delete the field and run the macro new."

    You can simple use your formula (field) tool and choose edit -> delete.

    Have to go into the weekend.

    So long, Reinhard
    Participating Frequently
    November 11, 2005
    Reinhard -

    Not sure what you mean - " Delete the field and run the macro new."

    This is the script I am running. I made a test file with it yesterday and today is still says Document printed on 10/nov/2005.

    What needs to be changed?

    for (var p = 0; p < this.numPages; p++)
    {
    var fd = this.addField("Date", "text", p, [72,0, 540,16]);
    fd.textSize=8;
    fd.value = "Document printed on: " + util.printd("dd/mmm/yyyy", new Date());
    fd.allignment = "right";
    fd.fillColor = color.transparent;
    fd.textColor = color.gray;
    fd.borderColor = color.gray;
    fd.readonly = true;
    }
    ReinhardF
    Participating Frequently
    November 11, 2005
    "Can you explain the [30,12, 100,28] ?"

    Coords are calculation from the left lower corner. 30 = Difference to left Side; 12 = Diff. to bottom; 100 = length of Field; 28 are high of field, which has to be set according to "fd.textSize=8" = font high.

    Play a little bit around with that. You need not center text, you can center the field. If you delete one field all fields will be deleted, because the have the same name.

    "Why didn't the date change?"
    new Date() delivers the actual date (not the production date). But it will be stored as value. Delete the field and run the macro new.

    HTH, Reinhard
    Participating Frequently
    November 11, 2005
    Reinhard -

    I opened a PDF I made yesterday per your instructions, and the date at the bottom still says 10/nov/2005. Today is 11/Nov/2005. Why didn't the date change?

    To re-iterate, I need the date displayed on all the PDFs to have the CURRENT DATE....not the date the PDF was made. Is there anyone who knows if this is possible? And if so...how do I do it?