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

Insert a file Name automatically in an PDF Form

New Here ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

Hello everyone, I would like to automatically add the document name to the footer of an Adobe PDF form. I use the Adobe Acrobat Pro version from the Creative Cloud. Is there a solution here?

 

its possible With an JavaScript Code?

 

Thank you

 

Bastian

TOPICS
Acrobat SDK and JavaScript

Views

11.8K

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
community guidelines
LEGEND ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

You can use JavaScript to access the documentFileName property. Here's some sample code that sets a text field value to the document file name:

 

getField("Text1").value = documentFileName;

 

But the correct code depends on when you want the code to set the field value and where the code is placed. If you provide more information about your workflow, we could probably provide more help.

Votes

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
community guidelines
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

If you use the code above place it as a doc-level script, so that it will update each time you open the file.

Votes

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
community guidelines
New Here ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

Can someone explain this more?  I don't understand where or what I'm supposed to do?

Votes

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
community guidelines
Community Expert ,
Mar 15, 2022 Mar 15, 2022

Copy link to clipboard

Copied

LATEST

Go to Tools - JavaScript - Document JavaScripts and create a new item (you can call it "scripts").

Delete all the default code that is created and replace it with the line of code above. Click OK and save the file, and it will execute each time you open it.

Votes

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
community guidelines
New Here ,
Aug 09, 2020 Aug 09, 2020

Copy link to clipboard

Copied

Hello
I want to show and hide a video on a page with a button What should I do?
In Adobe Acrobat DC

Votes

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
community guidelines
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

You don't need to reinvent the wheel, search for "File Name Stamper" on this page: https://acrobatusers.com/actions-exchange/

Votes

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
community guidelines
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

The problem (or feature, depending on how you look at it, I guess) with this Action is that it's a stamper, ie the name it adds is static. If you rename the file after running it it will still show the old file-name. That might be desired in some cases, but not in others. If you want it to be dynamic and always show the current file-name then it needs to be done using a field that is updated whenever the file is opened, as described above.

Votes

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
community guidelines
Community Beginner ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Thanks for the Note with the automatic update. I have an empty document and would like to display only the document name here, for example.

How to proceed then?

First I create a text field and give it a name, e.g. "DK_01".

Where do I enter the script so that it is updated when I open it?

Votes

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
community guidelines
Community Expert ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Under Tools - JavaScript - Document JavaScripts. Place the code outside of the function that is created when you add a new script. In fact, you can delete that function definition altogether.

Votes

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
community guidelines
Community Expert ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

PS. I would also set the field's defaultValue property in the code, so it doesn't clear when the form is reset.

Votes

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
community guidelines
Community Beginner ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Many thanks for the great support. It worked. Thanks a lot.

Now I just have to check the default settings you suggested.

Votes

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
community guidelines
Community Expert ,
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Basically just duplicate that line of code, changing value for defaultValue.

Votes

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
community guidelines