Copy link to clipboard
Copied
Hi all,
On the left, there is a document-opening function. If a PDF was saved in Photoshop, it will open without any additional parameters. However, if the file was created in Illustrator or InDesign, the specified parameters will be applied when opening it.
Now imagine a situation where layouts from a client come in different formats: some files were saved via Photoshop, others via Illustrator. Let’s say there are ten layouts in total, and five of them have different color modes, resolutions, and layer structures. In this case, during batch processing, you can’t be completely sure that each document will open with the desired settings — some may be opened while ignoring them.
In my opinion, it’s not possible to change this behavior directly through JSX. However, this isn’t a major problem if you know exactly where the relevant data is stored. It’s possible to use a Node.js library to modify or remove the necessary entries before opening the document — most likely in the XMP metadata. I haven’t worked with this before, so I’d appreciate it if you could recommend which Node.js library to use and how to delete or modify a specific line, if that’s possible in the context of this task.
Thank you in advance!
Copy link to clipboard
Copied
When you save a PDF from Photoshop, it's noted as being a "Photoshop PDF" and not a "generic PDF".
Photoshop opens the "Photoshop PDF" as it would do so with a PSD.
A "generic PDF" isn't as simple, requiring rasterisation and different source colour modes are converted to the destination mode and space.
So the key would appear to be for a script or other software recognising that not all PDF files are created equal and that "Photoshop PDF" are an exception.
Copy link to clipboard
Copied
Hi all,
On the left, there is a document-opening function. If a PDF was saved in Photoshop, it will open without any additional parameters. However, if the file was created in Illustrator or InDesign, the specified parameters will be applied when opening it.
Now imagine a situation where layouts from a client come in different formats: some files were saved via Photoshop, others via Illustrator. Let’s say there are ten layouts in total, and five of them have different color modes, resolutions, and layer structures. In this case, during batch processing, you can’t be completely sure that each document will open with the desired settings — some may be opened while ignoring them.
In my opinion, it’s not possible to change this behavior directly through JSX. However, this isn’t a major problem if you know exactly where the relevant data is stored. It’s possible to use a Node.js library to modify or remove the necessary entries before opening the document — most likely in the XMP metadata. I haven’t worked with this before, so I’d appreciate it if you could recommend which Node.js library to use and how to delete or modify a specific line, if that’s possible in the context of this task.
Thank you in advance! hha exchange
By @cmext73998110
You are correct that the issue lies in the **XMP metadata** embedded by Illustrator or InDesign, which overrides your Photoshop open parameters via JSX. To solve this during batch processing, the recommended approach is to use a Node.js wrapper for **ExifTool** (the industry-standard metadata utility). Before opening the PDF in Photoshop, your Node.js script should execute an ExifTool command—such as `exiftool -XMP-xmpMM:History= -XMP-xmp:CreatorTool="" -overwrite_original file.pdf`—to **delete the specific application-identifying metadata tags**. Removing these tags makes the PDF appear as a generic file, forcing Photoshop's `app.open()` function to apply the color mode, resolution, and layer settings you explicitly define in your JSX script.
Copy link to clipboard
Copied
I tried using the following set of commands to clean XMP and PDF Info.
I’m attaching a screenshot of the commands and the verification file:
The XMP metadata does change, but Photoshop still behaves the same — no desired result. Any ideas?
The test file, command list, and verification file are also attached.
Based on indirect evidence, the issue is probably not in the XMP data, but in the internal PDF structures such as /PieceInfo, /Private, /Photoshop, /XObject, /Resources, and other service objects that ExifTool does not modify.
# 1. Clean main XMP and PDF fields
npx -p exiftool-vendored exiftool `
-overwrite_original `
-XMP-xmpMM:History= `
-XMP-xmp:CreatorTool= `
-PDF:Creator= `
-PDF:Producer= `
-XMP:DocumentID= `
-XMP:InstanceID= `
-XMP:DerivedFrom= `
"$env:USERPROFILE\Desktop\photoshop file.pdf"
# 2. Full cleanup of all XMP and PDF Info fields
npx -p exiftool-vendored exiftool `
-overwrite_original `
-XMP:all= `
-PDF:All= `
"$env:USERPROFILE\Desktop\photoshop file.pdf"
# 3. Check cleaned fields
npx -p exiftool-vendored exiftool `
-a -G1 -s `
-XMP-xmpMM:History `
-XMP-xmp:CreatorTool `
-PDF:Creator `
-PDF:Producer `
"$env:USERPROFILE\Desktop\photoshop file.pdf"
# 4. Verify via Node.js script
node .\check-xmp.mjs "$env:USERPROFILE\Desktop\photoshop file.pdf"
// check-xmp.mjs
import { exiftool } from 'exiftool-vendored';
const data = await exiftool.read(process.argv[2]);
const pick = (obj, keys) =>
Object.fromEntries(keys.map(k => [k, obj[k]]).filter(([_, v]) => v !== undefined));
const important = pick(data, [
'Creator', // PDF:Creator
'Producer', // PDF:Producer
'CreatorTool', // XMP xmp:CreatorTool
'History', // XMP xmpMM:History
'DocumentID', // XMP:DocumentID
'InstanceID', // XMP:InstanceID
'DerivedFromDocumentID',
'DerivedFromInstanceID'
]);
console.log('Key tags:');
console.log(important);
await exiftool.end();
Copy link to clipboard
Copied
The only working method for now is to modify the PDF using pdf-lib by adding a blank page at the end and then open the first page in JSX. However, this is still not the ideal solution(
import { PDFDocument } from "pdf-lib";
import fs from "fs";
const filePath = `${process.env.USERPROFILE}\\Desktop\\photoshop file.pdf`;
(async () => {
try {
const bytes = fs.readFileSync(filePath);
const pdfDoc = await PDFDocument.load(bytes);
const pagesBefore = pdfDoc.getPageCount();
const { width, height } = pdfDoc.getPage(pagesBefore - 1).getSize();
pdfDoc.addPage([width, height]);
const pdfBytes = await pdfDoc.save();
fs.writeFileSync(filePath, pdfBytes);
} catch (e) {
process.exit(1);
}
})();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now