Want to display image file name associated with Image Form Field
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you. I was afraid of that. Appreciate your fast response.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
It's not impossible, but it's not easy, either, as I've explained above.
Copy link to clipboard
Copied
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.
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.

