Highlighted

Actual Date in PDF via inDesign

Community Beginner ,
Sep 01, 2020

Copy link to clipboard

Copied

Hi,

 

i am looking for a solution to create a document with an intelligent date field.

The content of the field should automatically show the actual date in the PRINT PDF so we can see when the artwork is printed. The workflow should be that the responsible person will open the PDF and print the file. On the artwork there is a small text which shows the actual print date.

 

I found out that it is possible to create a manual form field via Acrobat DC and add a Java Script in the PDF afterwards but I am looking for a clean solution directly out of inDesign cause manual optimazation is to risky for errors. Found this Script Code fot the Acrobat workaround:

 

Create form field with name: "date" and open Java Script Tools

Insert following phrase:

 

var datum = this.getField("datum");
var jetzt = new Date();

var tag = jetzt.getDate();
var monat = jetzt.getMonth() +1;
var jahr = jetzt.getYear() +1900;

datum.value = tag+"."+monat+"."+jahr;

 

So i am looking for an workaround to handle this directly in inDesign CC.

The PDF should not be written manually each time so the date in the PDF should update itself without any rework process in inDesign.

Looking forward to your support!

 

TOPICS
How to, Import and export, Print, Scripting

Views

103

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Actual Date in PDF via inDesign

Community Beginner ,
Sep 01, 2020

Copy link to clipboard

Copied

Hi,

 

i am looking for a solution to create a document with an intelligent date field.

The content of the field should automatically show the actual date in the PRINT PDF so we can see when the artwork is printed. The workflow should be that the responsible person will open the PDF and print the file. On the artwork there is a small text which shows the actual print date.

 

I found out that it is possible to create a manual form field via Acrobat DC and add a Java Script in the PDF afterwards but I am looking for a clean solution directly out of inDesign cause manual optimazation is to risky for errors. Found this Script Code fot the Acrobat workaround:

 

Create form field with name: "date" and open Java Script Tools

Insert following phrase:

 

var datum = this.getField("datum");
var jetzt = new Date();

var tag = jetzt.getDate();
var monat = jetzt.getMonth() +1;
var jahr = jetzt.getYear() +1900;

datum.value = tag+"."+monat+"."+jahr;

 

So i am looking for an workaround to handle this directly in inDesign CC.

The PDF should not be written manually each time so the date in the PDF should update itself without any rework process in inDesign.

Looking forward to your support!

 

TOPICS
How to, Import and export, Print, Scripting

Views

104

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 01, 2020 0
Adobe Community Professional ,
Sep 01, 2020

Copy link to clipboard

Copied

1. You mention a print pdf. But as soon as you have added a form field, it becomes an interactive PDF. If you export an interactive PDF from InDesign, only RGB colours are supported, not CMYK.

2. It is not possible to add Acro scripts in InDesign without an add-on like https://www.id-extras.com/products/formmaker/

3. If you add the script you posted above as a document JavaScript in Acrobat, it will indeed be run every time the document is opened (in PDF readers that support document Javascripts, such as Adobe's free PDF reader).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 01, 2020 1
Adobe Community Professional ,
Sep 01, 2020

Copy link to clipboard

Copied

Hi,

 

This is an answer of the top of my head, I will take a look and check that it is correct, for the script to run to update the text field in Acrobat it has to be attached to a known event (probably Doc/WillPrint) and to attach to the event in Acrobat you usually create a document level script in the PDF file, which registers for that event and runs some code, in this case to change the date. However, as far as I am aware that is not possible in InDesign ( the part I need to check).

 

So currectly the only option would be to update the PDF once it has been created, although it could be updated once and then the date should update everytime it is printed/opened.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 01, 2020 0
Most Valuable Participant ,
Sep 01, 2020

Copy link to clipboard

Copied

> var jahr = jetzt.getYear() +1900;

NO!!! Use getFullYear, instead.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 01, 2020 0
Adobe Community Professional ,
Sep 01, 2020

Copy link to clipboard

Copied

I'm imagining you want a similar task to the Acrobat script, and not actually inserting a field that you'd later put into acrobat and type... correct?

Two ways. First is to use a text variable from the type menu/text variables and then choose output date.

Second is to write a custom script that listens to any time a PDF is exported, and when a PDF is made, adjusts the date accordingly. But that is doing exactly the same thing the first method is doing so I don't think a script is the answer.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 01, 2020 0
Community Beginner ,
Sep 02, 2020

Copy link to clipboard

Copied

thx for your comment - I am looking for a method to realize this in inDesign cause the exported PDF file will be sent to our customer. So we wont create a new PDF file for the date. Only when our customer opens the document the date should update automatically.

The reason why we dont intecrate this once via Acrobat is cause in case we make an update on the artwork via inDesign there is a risk that we forget the aditional step in Acrobat with the date field and then no date will be visible on the artwork. The date is for checking the batch number in case of reclamations.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 02, 2020 0