Copy link to clipboard
Copied
Hello,
I have an indesign document that has 1 image on each page (proportionally filling a grame, with a drop shadow applied and layered over a solid color background).
I am trying to export the individual pages as individual JPGs (which I know how to do) but I want the exported filenames to match the link filename for each page.
I think this is possible via scripts, but can you please let me know how to do this?
Photoshop will not work for this task, so please do not suggest I batch or automate there. Thanks!
You can automate the creation of captions by selecting all image in the Links panel and choosing Captions in the panel options.
Copy link to clipboard
Copied
First use the captions features of InDesign that create a text frame with the extracted filename. Assign a paragraph style for this only. Make your paragraph style use 0.1 pt size text with None color so it will be invisible.
Than you can use this script in this thread.
https://community.adobe.com/t5/indesign/export-pages-to-jpg-with-individual-filenames-from-photo-cap...
Copy link to clipboard
Copied
Thanks! I tried that but I got this error...
Copy link to clipboard
Copied
Regarding the errors, humm. Maybe something special in the naming.
Copy link to clipboard
Copied
Oh, and don’t use lice captions but static one.
Copy link to clipboard
Copied
Thanks! Ok, got the captions going!
Just having a tough time with that script. Now when I double click it, it says this and nothing happens.
Copy link to clipboard
Copied
Yep... do what the message is saying! Place your cursor inside one of the captions text box. Assuming you have use a dedicated paragraph style for it.
Copy link to clipboard
Copied
Also, I need to be able to automate this for 100+ images. Is there a way to automate adding the caption part?
Thank you!
Copy link to clipboard
Copied
You can automate the creation of captions by selecting all image in the Links panel and choosing Captions in the panel options.
Copy link to clipboard
Copied
Simply, assuming only one graphic object per page:
try {
var doc = app.activeDocument;
} catch(e) { exit(); }
try {
var docPath = doc.filePath;
} catch(e) {
alert("Save the doc first!");
exit();
}
var pages = doc.pages.everyItem().getElements();
var jpgOptions = app.jpegExportPreferences;
var errorPages = [];
var aLinkName, aPage;
for (var i = 0; i < pages.length; i++) {
try {
aLinkName = "";
aPage = pages[i];
aLinkName = aPage.allGraphics[0].itemLink.name.replace(/\..+/gi,"");
jpgOptions.pageString = aPage.name;
if (aLinkName != "") {
doc.exportFile(ExportFormat.JPG, File(docPath + "/" + aLinkName + ".jpg"), false);
} else {
errorPages.push(aPage.name);
}
} catch(e) {
errorPages.push(aPage.name);
}
}
alert("Done!");
if (errorPages.length > 0) {
alert("There were errors doing these pages!\r" + errorPages.join(", ");
}
Copy link to clipboard
Copied
That’s even easier...