How to Display an Image Filename in a PDF Form Text Field in Adobe Acrobat
Question details
The user wants to automatically copy the filename of an imported image into a corresponding text field within a PDF form containing multiple images.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or filling out a PDF form with image fields where the original filenames of the uploaded images need to be tracked and displayed.
- Observed behavior
- Adobe Acrobat does not natively expose or automatically copy the filename of an imported image into a text field.
Since this process requires custom JavaScript execution, ensure that your PDF viewer supports scripting and that you have sufficient administrative permissions to run and install local folder-level scripts on your computer.
Use a Custom Folder-Level JavaScript for Image Import
Because native form fields do not expose the image filename, you must use a custom script installed on the local machine to handle file selection and text extraction.
Adobe Acrobat's native image field imports the image data but does not retain or expose the source file's metadata, including the filename, to the form's data structure.
To bypass this limitation, you can implement a folder-level script that uses a custom dialog for file selection. This script will grab the file path, extract the filename, populate your designated text field, and then apply the selected image as an icon to a button field.
Create a custom JavaScript file (.js) containing a trusted function for file selection. Save this file into Adobe Acrobat's local 'JavaScripts' folder on your machine.
Open your PDF form in Edit mode. Replace the standard image field with a Button field, and create a standard Text field nearby to display the extracted filename.
Right-click the Button field and go to 'Properties'. Under the 'Actions' tab, select 'Mouse Up' as the trigger and 'Run a JavaScript' as the action. Enter the code to call your custom trusted function, which will prompt the user to select an image, set the button icon, and fill the text field with the filename.

Manage Standard PDF Forms Easily with WPS Office
While advanced JavaScript integration for local file extraction is limited in standard PDF forms, WPS Office provides a lightweight, highly compatible, and user-friendly suite for everyday PDF editing, form filling, and document workflows.
- 1. Download and Install: Download WPS Office from the official website and complete the quick installation process.
- 2. Open Your PDF Form: Launch WPS PDF and click 'Open' to select your PDF form document.
- 3. Fill and Edit: Navigate to the 'Form' or 'Fill & Sign' tab to interact with standard text fields, checkboxes, and image placeholders directly.

Frequently Asked Questions
Can I extract the filename from an image already inserted into a PDF?
No. Once an image is imported into a standard PDF form field, the original filename and file path are stripped from the document for security and privacy reasons.
Do standard PDF forms support automatic metadata extraction?
Generally, standard PDF forms do not natively extract file metadata (like filenames or dates) from uploaded attachments or images without utilizing custom folder-level JavaScript.
Why does my folder-level script not work on other computers?
Folder-level scripts are stored locally on a specific machine's hard drive. For the script to execute successfully on another computer, you must manually install the exact script file into that computer's Acrobat JavaScript directory.




