• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

420

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert ,
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...

 

Votes

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

Votes

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
Community Expert ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

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

Votes

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
Community Expert ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

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

Votes

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

Votes

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
Community Expert ,
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.

Votes

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!

Votes

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
Community Expert ,
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.

Votes

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

 

 

Votes

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
Community Expert ,
Mar 19, 2021 Mar 19, 2021

Copy link to clipboard

Copied

LATEST

That’s even easier... 

Votes

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