Skip to main content
Ramjivk
Inspiring
December 12, 2013
Answered

Export selected items on each page in InDesign to JPEG

  • December 12, 2013
  • 1 reply
  • 1511 views

Hi All,

I have InDesign CS5.5. I have a document with more than 50 pages and each page has unique image and the description for image.

I need to export each page as JPEG. but i don't want to export full page. i need only the items on each page. So i go to each page and select all the items and export. while exporting i use the same name of the image used in each page.

I tried writing a script but it exports only the active page. i do not know how to navigate to the next page and export.

is some one can help.

below is my script.

var myDoc = app.activeDocument;

var myNumPages = myDoc.pages.length;  //get the number of pages

var myFilePath = myDoc.filePath; //get the file path

var myRectangle = app.activeWindow.activePage.allGraphics; //get the graphics of the active page

var myPageName = app.activeWindow.activePage.name; //get the page name.

           if(myRectangle.length >1)

          {

                    alert("the page has more than one image. Delete the other image to export");

                    exit();

          }

var myImageName = myRectangle[0].itemLink.name; //get the name of the image

app.select(NothingEnum.NOTHING);

for(var i=0; i<myNumPages; i++)

{

 

          app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;

          app.jpegExportPreferences.exportResolution = 300;

          app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;

          app.jpegExportPreferences.pageString = myPageName;

 

          mySelectedItems();

}

function mySelectedItems()

{

          var myObj = new Array;

          myObj = app.activeWindow.activePage.pageItems; 

          try

                    {

                              app.activeWindow.activePage.groups.add(myObj);

                    }

                              catch(e)

                    {

 

                    }

          app.select(app.activeWindow.activePage.allPageItems);

          app.selection[0].exportFile(ExportFormat.JPG, File(myFilePath+"/"+myImageName+".JPEG"), false);

 

}

This topic has been closed for replies.
Correct answer INDD4

export all image of each page try like this

var myDoc = app.activeDocument;

var myFolder = myDoc.filePath;

var myImage = myDoc.allGraphics;

for (var i=0; myImage.length>i; i++){

    app.select(myImage);

    var MyImageNmae  = myImage.itemLink.name;

    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;

    app.jpegExportPreferences.exportResolution = 300;

       app.selection[0].exportFile(ExportFormat.JPG, File(myFolder+"/"+MyImageNmae+".JPEG"), false);

    alert(myImage.itemLink.name)

    }

1 reply

INDD4Correct answer
Inspiring
December 12, 2013

export all image of each page try like this

var myDoc = app.activeDocument;

var myFolder = myDoc.filePath;

var myImage = myDoc.allGraphics;

for (var i=0; myImage.length>i; i++){

    app.select(myImage);

    var MyImageNmae  = myImage.itemLink.name;

    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;

    app.jpegExportPreferences.exportResolution = 300;

       app.selection[0].exportFile(ExportFormat.JPG, File(myFolder+"/"+MyImageNmae+".JPEG"), false);

    alert(myImage.itemLink.name)

    }

Ramjivk
RamjivkAuthor
Inspiring
December 12, 2013

Hi Mi_D.

Thanks for the script. i used the script it exports all the image as JPEG.

But, I have a document more than 50 page and each page has image and some text with descriptions (optional for some images). I want to export the image along with the texts. can you please help how to do that?

thanks.

Inspiring
December 12, 2013

Hi Ramjivk,

just i went to know that all test frame or only image description text frame and one more thing image and description text are in group

Mi_D