How to Combine JPEG Files into a PDF with Filenames in Headers
Question details
The user wants to merge multiple JPEG image files into a single PDF document and automatically display each image's original filename in the header or footer of its corresponding page.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Merging multiple scanned JPEG images into a unified PDF document while ensuring the source file identification is retained visibly on each page.
- Observed behavior
- Standard PDF editors combine the image files but do not automatically stamp the original filenames into the headers or footers without the use of custom scripts or third-party add-ons.
Ensure all your JPEG files are appropriately named and organized in a single folder, as these filenames will be extracted to create the bookmarks and headers.
Use Adobe Acrobat with a Custom JavaScript Action
Combine the images, generate bookmarks from the filenames, and use a specialized JavaScript tool to stamp the bookmark names onto the headers.
Standard PDF editors, including Acrobat, can combine JPEG files seamlessly. However, automatically stamping each original filename into the page header or footer is not a built-in, one-click feature.
To achieve this, you must rely on a two-step workaround: first generating bookmarks based on the filenames, and then running a script to convert those bookmarks into visible headers.
Open Acrobat, go to the 'Tools' menu, and select 'Combine Files'. Add all your target JPEG images to the workspace.
Before finalizing the merge, check the options to ensure the setting 'Add Bookmarks to Adobe PDF' is enabled. This will generate a bookmark for every page using the original JPEG filename.
Use a custom Acrobat JavaScript or download a specialized PDF scripting tool (such as a Bookmark-to-Footer Action script). Run the script to extract the names of the bookmarks and automatically place them in the header or footer of the corresponding pages.

Combine JPEGs to PDF and Add Custom Headers with WPS Office
WPS PDF provides a user-friendly and efficient way to merge multiple images into a high-quality PDF document. Once combined, you can quickly navigate to the page setup settings to batch-add custom headers, footers, and page numbers.
- 1. Import JPEGs into WPS Office: Open WPS Office, navigate to the 'PDF' section, and select the 'Picture to PDF' tool to import your JPEG files.
- 2. Convert and merge: Arrange your images in the desired order and click 'Convert' to merge the selected pictures into a single PDF document.
- 3. Access Header and Footer settings: Go to the 'Insert' tab on the top ribbon and click on 'Header and Footer', then choose 'Add Header and Footer'.
- 4. Add custom text: Type your desired labels or filenames into the header fields. Apply the settings to specific page ranges as needed.
- 5. Save the document: Review your updated PDF pages and click 'Save' or press Ctrl+S to export the final file.

Frequently Asked Questions
Can I combine JPEGs to PDF without losing image quality?
Yes. Most professional PDF editors, including WPS PDF and Adobe Acrobat, offer settings to retain the original resolution of your images during the merging process. Look for 'High Quality', 'Original Size', or 'Lossless' options before initiating the conversion.
Is there a completely automated way to stamp filenames without scripts?
Currently, standard PDF editors do not offer a native one-click function to map source filenames to page headers during a merge. Custom scripting or specialized third-party batch processors are typically required for full automation.
Why don't my merged PDFs automatically show the original JPEG names?
Standard PDF merging tools compile only the visual data of the images and discard external file metadata (like the filename) from the visible page layout to keep the document clean. The filenames are only retained as bookmarks if that specific option is checked.




