2 Replies Latest reply on Nov 27, 2018 6:28 PM by Sudha K

    Export JPEG for selection with multiple items

    Sudha K Level 1



           I am trying to export selection which contains more than one objects.  It should be exported as single jpeg object.  I can do it for single selection but could not able to do it for multiple objects. Throwing the below error...


           How to do it for selection of multiple objects?



      var jpgName = "/Applications/Adobe InDesign CS6/Scripts/Scripts Panel/Test/SAMPLE.jpeg"


      ExportAsJPEG(app.selection, jpgName);



      function ExportAsJPEG(obj, tName)




                  embedColorProfile = true; 

                  jpegQuality = JPEGOptionsQuality.MAXIMUM; 

                  exportResolution =  120;         

                  jpegColorSpace = JpegColorSpaceEnum.RGB; 

                  jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;

                  simulateOverprint = false; 

                  antiAlias = true; 

                  transparentBackground = false; 

                  useDocumentBleeds = false; 


                  exportingSpread = false; 

                  jpegExportRange = ExportRangeOrAllPages.EXPORT_ALL; 



              obj.exportFile(ExportFormat.JPEG, File(tName));  











      Sudha K

        • 1. Re: Export JPEG for selection with multiple items
          Manan Joshi Adobe Community Professional

          In the case of multiple objects the app.selection would be an array and an array does not have the method exportFile so the error does make sense. As regards to what you are trying to do i would suggest to do the following

          • If the no of selected objects is greater than 1, group them
          • Call your export method on this group object
          • Once the export is complete, ungroup the group created in step 1



          1 person found this helpful
          • 2. Re: Export JPEG for selection with multiple items
            Sudha K Level 1



                 Thank you.... Actually i had tried this flow but its also thrown error...


                 Now i rectified my error.. I used wrong format JPEG instead of JPG.


                 obj.exportFile(ExportFormat.JPEG, File(tName));       --     Error


                 obj.exportFile(ExportFormat.JPG, File(tName));  --- Correct

                 Now its working...


            - Sudha K