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

Want to display image file name associated with Image Form Field

New Here ,
Apr 29, 2021 Apr 29, 2021

I have a PDF that I've created a standard image form field on...Click on the icon and browse to find your image, and it appears in the PDF.
I would like a separate field to also display that same image's file name.


Can this be automated easily? I can't find an exact answer, and none of the JS I've tried have work.

 

I want end product to look like this, where the image file name is displayed and self-populates based upon whatever image is chosen.

Screen Shot 2021-04-29 at 11.41.31 PM.pngexpand image

TOPICS
Create PDFs , How to , JavaScript , PDF forms
1.2K
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 ,
Apr 30, 2021 Apr 30, 2021

No, not easily.

In order to do that you would need a different command for selecting the file, then copying the path to a text field (or even the caption of the image field itself), and another command to import it as the icon of the image field. However, the latter requires installing a script on the local computer of each user, which is not always possible.

 

Cute cat, by the way.

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 ,
Apr 30, 2021 Apr 30, 2021

Thank you. I was afraid of that. Appreciate your fast response.

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 ,
Mar 27, 2025 Mar 27, 2025

Hello, I also need to do that regularly but impossible to add file name next or under photos when I issue a new PDF with combination of photos.

Very annoying, and even the new AI assistant don't "understand" the request... another AI tool which is not working fully. A pity.

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 ,
Mar 27, 2025 Mar 27, 2025

It's not impossible, but it's not easy, either, as I've explained above.

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
Adobe Employee ,
Mar 27, 2025 Mar 27, 2025
LATEST

Hi @Belenus22999194ehsb,

 

Hope you are doing well. Thanks for writing in!

 

This will not work in Acrobat because Acrobat JavaScript does not provide access to the file path or filename of an imported image due to security restrictions.

 

Since you can't automatically extract the filename, the only workaround is to prompt the viewer to enter the filename manually when they select an image.

 
An example script could be:

var f = this.getField("imageField");
f.buttonImportIcon(); 

var filename = app.response("Enter the image filename:", "Filename Input");
if (filename) {
    this.getField("filenameField").value = filename;
}

 

How it works will be:

 

  • You select an image for imageField.

  • A prompt will appear asking you to manually enter the filename.

  • The entered filename is displayed in filenameField.

 

Hope this will help.


Regards,
Souvik.

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