Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Export Pages as JPG with Filename same as Link

New Here ,
Mar 19, 2021 Mar 19, 2021

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!

TOPICS
Scripting

Views

178

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 19, 2021 Mar 19, 2021
You can automate the creation of captions by selecting all image in the Links panel and choosing Captions in the panel options.

Likes

Translate

Translate
Advocate ,
Mar 19, 2021 Mar 19, 2021

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...

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

Thanks! I tried that but I got this error... Screen Shot 2021-03-19 at 5.26.35 PM.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

Regarding the errors, humm. Maybe something special in the naming. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

Oh, and don’t use lice captions but static one.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2021 Mar 19, 2021

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. 

Screen Shot 2021-03-19 at 5.59.41 PM.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2021 Mar 19, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2021 Mar 19, 2021

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2021 Mar 19, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 19, 2021 Mar 19, 2021

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(", ");
}

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

LATEST

That’s even easier... 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines