Skip to main content
Jokewsmns
Participant
April 4, 2018
Question

InDesign - Use name links for export JPG

  • April 4, 2018
  • 3 replies
  • 2360 views

Hi,

I'm looking for a solution.

I create images with a specific name. After that I create a book in indesign that we can easily print to go to our customers.

In this document every picture is one page.

I also have to update a folder on our server, in this folder I have to have the same pictures as the ones in my book.

So it would be great if there is a tool in Indesign that i can use to export all pages with the name of the pictures (links) I used, so my folder on the server is automatically up to date by one click.

Is there a way that I can export every page with the name of the picture on the page? Or export my links?

Thanks

Sofie

    This topic has been closed for replies.

    3 replies

    Anna Lander
    Inspiring
    April 5, 2018

    You can't keep the image names exporting them from InDesign. So yes, if you wand collect the images to the folder on the server, the best way is to package them. If you need to decrease their sizes, the way is Automate in Photoshop. So you can act by 2 steps:

    (0 — create the action that will decrease the sizes and save the images where you want)

    1/ Package the actual image set of your document.

    2/ Start Automate > Batch > your action and your Package folder.

    It's not one click but two, also quite good

    Randermax
    Participant
    May 8, 2023

    #target indesign

    var myDocument = app.activeDocument;
    var myExportadas = new Array;
    var myErro = new Array;

    var w = new Window ('palette', 'Exportando Imagens...');
    w.pbar = w.add ('progressbar', undefined, 0, myDocument.pages.length);
    w.pbar.preferredSize.width = 300;
    w.show();

    for(var i = 0; i < myDocument.pages.length; i++){
    var myPageNumber = i;
    var myPage = myDocument.pages[myPageNumber];

    var myDescricao = pegarDescricao(myPageNumber, myPage);


    var myParentFolder = File(myPage.pageItems[myDescricao].graphics[0].itemLink.filePath).parent.parent
    var myFileName = myPage.pageItems[myDescricao].graphics[0].itemLink.linkXmp.description;
    if(myFileName == ""){
    var myTime = new Date()
    myFileName = myTime.getTime().toString();
    }
    var myPath = "" + myParentFolder + "/" + myFileName + ".jpg";

    //Exportando o arquivo JPG
    try{
    exportThumb(myPageNumber, myPath);
    myExportadas.push(i +1);
    }catch(e){
    alert("A página " + i+1 + " não pode ser exportada.\r Erro: " + e);
    myErro.push(i + 1);
    }


    //Barra de progresso
    //~ var w = new Window ('palette', 'Exportando Imagens...');
    //~ w.pbar = w.add ('progressbar', undefined, 0, myDocument.pages.length);
    //~ w.pbar.preferredSize.width = 300;
    //~ w.show();
    w.pbar.value = i + 1;
    }

    alert("Exportação concluída.\r\rPáginas exportadas com sucesso: " + myExportadas.join(", ") + ".\rPáginas não exportadas: " + myErro.join("\r"));
    exit();

     

    //Exportando a páina
    function exportThumb(myPageNumber, myPath){
    var myDocument = app.activeDocument;
    app.jpegExportPreferences.properties = {
    antiAlias: true,
    embedColorProfile: true,
    exportResolution: 300,
    jpegColorSpace: JpegColorSpaceEnum.rgb,
    jpegExportRange: ExportRangeOrAllPages.exportRange,
    jpegQuality: JPEGOptionsQuality.maximum,
    jpegRenderingStyle: JPEGOptionsFormat.baselineEncoding,
    useDocumentBleeds: false,
    simulateOverprint: false,
    pageString: "" + myDocument.pages[myPageNumber].name
    }
    var myFile = myPath
    var myTempFile = File(myFile);
    myDocument.exportFile(ExportFormat.jpg, myTempFile);
    }

     

     

     

    //Detectando qual a imagem que servirá como base de exportação
    function pegarDescricao(myPageNumber, myPage){
    var myImageStatus = new Array;
    for(var i = 0; i < myDocument.pages[myPageNumber].pageItems.length; i++){

    if(myDocument.pages[myPageNumber].pageItems[i].graphics.length != 0){
    myImageStatus.push(myDocument.pages[myPageNumber].pageItems[i].graphics[0].itemLink.status);
    }else{
    myImageStatus.push("NULL");
    }

    }
    var myQual = "";
    for(var i = 0; i < myImageStatus.length; i++){
    if(myImageStatus[i].toString() == "NORMAL"){
    myQual = i;
    }
    }
    return myQual;
    }

     

    Randermax
    Participant
    July 21, 2023

    target indesign

    var myDocument = app.activeDocument;
    var myExportadas = new Array;
    var myErro = new Array;

    var w = new Window ('palette', 'Exportando Imagens...');
    w.pbar = w.add ('progressbar', undefined, 0, myDocument.pages.length);
    w.pbar.preferredSize.width = 300;
    w.show();

    for(var i = 0; i < myDocument.pages.length; i++){
    var myPageNumber = i;
    var myPage = myDocument.pages[myPageNumber];

    var myDescricao = pegarDescricao(myPageNumber, myPage);


    var myParentFolder = File(myPage.pageItems[myDescricao].graphics[0].itemLink.filePath).parent.parent
    var myFileName = myPage.pageItems[myDescricao].graphics[0].itemLink.name;
    if(myFileName == ""){
    var myTime = new Date()
    myFileName = myTime.getTime().toString();
    }
    var myPath = "" + myParentFolder + "/" + myFileName;

    //Exportando o arquivo JPG
    try{
    exportThumb(myPageNumber, myPath);
    myExportadas.push(i +1);
    }catch(e){
    alert("A página " + i+1 + " não pode ser exportada.\r Erro: " + e);
    myErro.push(i + 1);
    }


    //Barra de progresso
    //~ var w = new Window ('palette', 'Exportando Imagens...');
    //~ w.pbar = w.add ('progressbar', undefined, 0, myDocument.pages.length);
    //~ w.pbar.preferredSize.width = 300;
    //~ w.show();
    w.pbar.value = i + 1;
    }

    alert("Exportação concluída.\r\rPáginas exportadas com sucesso: " + myExportadas.join(", ") + ".\rPáginas não exportadas: " + myErro.join("\r"));
    exit();

     

    //Exportando a páina
    function exportThumb(myPageNumber, myPath){
    var myDocument = app.activeDocument;
    app.jpegExportPreferences.properties = {
    antiAlias: true,
    embedColorProfile: true,
    exportResolution: 300,
    jpegColorSpace: JpegColorSpaceEnum.rgb,
    jpegExportRange: ExportRangeOrAllPages.exportRange,
    jpegQuality: JPEGOptionsQuality.maximum,
    jpegRenderingStyle: JPEGOptionsFormat.baselineEncoding,
    useDocumentBleeds: false,
    simulateOverprint: false,
    pageString: "" + myDocument.pages[myPageNumber].name
    }
    var myFile = myPath
    var myTempFile = File(myFile);
    myDocument.exportFile(ExportFormat.jpg, myTempFile);
    }

     

     

     

    //Detectando qual a imagem que servirá como base de exportação
    function pegarDescricao(myPageNumber, myPage){
    var myImageStatus = new Array;
    for(var i = 0; i < myDocument.pages[myPageNumber].pageItems.length; i++){

    if(myDocument.pages[myPageNumber].pageItems[i].graphics.length != 0){
    myImageStatus.push(myDocument.pages[myPageNumber].pageItems[i].graphics[0].itemLink.status);
    }else{
    myImageStatus.push("NULL");
    }

    }
    var myQual = "";
    for(var i = 0; i < myImageStatus.length; i++){
    if(myImageStatus[i].toString() == "NORMAL"){
    myQual = i;
    }
    }
    return myQual;
    }

     

    c.pfaffenbichler
    Community Expert
    Community Expert
    April 5, 2018

    Which format do you need to export the pages as?

    I expect what you describe should be possible to be scripted, if you want to pursue that option you may want to post on the Indesign Scripting Forum.

    rob day
    Community Expert
    Community Expert
    April 4, 2018

    Or export my links

    File>Package will copy all of the links into one folder. From the Links panel there is also Utilities>Copy Links, but that will move and relink all of the links to the chosen folder.

    Jokewsmns
    JokewsmnsAuthor
    Participant
    April 5, 2018

    Thank you for your answer.

    I already tried the Utilities>Copy Links, but indeed than the file relinks all the files.

    I forgot to tell that the jpg files on my server have to be a smaller resolution, our sales people use the files to send by mail to our customers. Do you know if I can change the resolution when I export the package, to a smaller resolution?

    winterm
    Legend
    April 5, 2018

    Sounds like a job for Photoshop.

    Package all your links in one folder, create an Action in Photoshop (open file - resize to desired values - save as jpg to different folder - close file). Then use File > Automate > Batch dialog. Define your Action to use, Source and Destination folders, File naming conventions, other settings here.

    This approach also works if you want jpegs from InDesign pages exported to pdf. You just need to have one page per one pdf file.