Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Add User name on PDF when print

Community Beginner ,
Jan 03, 2021 Jan 03, 2021

I want to find the Java that will allow to add the user ID on the document when they print and a time stamp on the side. 

TOPICS
PDF forms
3.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 03, 2021 Jan 03, 2021

Don't look for Java code. Acrobat uses Javascript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 04, 2021 Jan 04, 2021

Correction Im looking for the Java Script

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 04, 2021 Jan 04, 2021

No, JavaScript. Not Java Script. It's important: if you don't spell it exactly that way you won't find the right stuff in Google.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

You can't access the login name of the user directly. It requires a special context, such as a script installed on the local machine. Is that something you can do for each user who is going to use this file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 04, 2021 Jan 04, 2021

I was thinking using this:

 

userName = identity.loginName;

 

Will that work? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

No. It will yield this error message:

NotAllowedError: Security settings prevent access to this property or method.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 04, 2021 Jan 04, 2021

Well that will not be usefull. I guess I should settle witha time-stamp. like a date and time it was printed. how that will work? Sorry for the random questions. Im new to this

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

No, that's fine. And yes, that is much easier to do. You can create a text field (let's call it "PrintText") and set it as "Hidden, but printable". Then under Tools - JavaScript - Set Document Actions - Document Will Print enter the following code:

 

this.getField("PrintText").value = "Printed on " + util.printd("mm/dd/yyyy HH:MM", new Date());

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 04, 2021 Jan 04, 2021

1 last question. how do I add a print button on the doc? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

You can add a button that executes the File - Print menu item, or the following code:

this.print();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2022 Aug 17, 2022
LATEST

can somebody help me with this please.

 

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