5 Replies Latest reply on Sep 8, 2010 2:32 AM by [Jongware]

    How to embed images in an INX file using script

    Anitha Selvaraj Level 2

      Hi All,

       

      Kindly help me in embedding images in INX file using Indesign Javascript.

       

      I have used the following code to embed images in an indd document and exporting that document to inx. But the images in inx are not embedded by default.

       

      var linksCount = myDocument.links.count();
      var linksOnPage = myDocument.links;
      for(var x=0;x<linksCount;x++){
          var linkedItem = linksOnPage.item(0);
          linkedItem.unlink();
      }

       

      myDocument.save(new File("filename.indd"));

      myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"), app.pdfExportPresets.item("[Press Quality]"));

       

      Thanks in advance,

      Anitha

        • 1. Re: How to embed images in an INX file using script
          milligramme Level 3

          Hi

          I think your script has two mistakes

          1. you embed only first link image in for loop => set x for linksOnPage
          2. exporting to inx isnot need PDF export preset => remove app.pdfExportPresets.item("[Press Quality]") from exportFile()

          this work for me.

           

          myDocument = app.documents[0];

          var linksCount = myDocument.links.count();
          var linksOnPage = myDocument.links;
          for(var x=0;x < linksCount;x++){
              var linkedItem = linksOnPage.item(x);
              linkedItem.unlink();
          }



          myDocument.save(new File("filename.indd"));

          myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"));

          thank you

          • 2. Re: How to embed images in an INX file using script
            Anitha Selvaraj Level 2

            Hi,

             

            Thanks a lot for giving the solution. It worked. But the file size of the INX is so huge when compared to INDD document.

             

            Please provide me some solution to reduce the size of the INX file.

             

            Thanks,
            Anitha

            • 3. Re: How to embed images in an INX file using script
              [Jongware] Most Valuable Participant

              Then throw out the images.

              Your INDD file size also grows (by exactly the amount of the total file size of your images, if I'm not mistaken), but exporting it to INX makes it much, much worse. INX is an uncompressed ASCII file, and the binary information of images expands *hugely* when you convert it into ASCII notation.

               

              If you only want to decrease the file size to be able to send it around per mail, compress the INX file itself. Plain ASCII text compresses wonderfully, often to 50% and sometimes much less than that.

              • 4. Re: How to embed images in an INX file using script
                Anitha Selvaraj Level 2

                Hi Jongware,

                 

                Thanks for your reply. As you said, the file size increases when the number of images increases. I can't throw out the images because the customer needs the images to be embedded in the file. Can you please provide some sample script which compresses the INX.

                 

                Thanks,

                Anitha

                • 5. Re: How to embed images in an INX file using script
                  [Jongware] Most Valuable Participant

                  wot script? just right-click the file and choose "Compress [filename]" (Mac OS X) or "Send to ->  Compressed (Zipped) Folder" (Windows).

                   

                  If you want to have a script to automatically zip up your file, it needs more work (e.g., downloading an external zip program and calling that as an external command), & I can't help you with that.