4 Replies Latest reply on Mar 25, 2014 5:53 AM by Dim48

    PNG Export Scripting?

    Dim48

      Hi,

       

      I'm currently developing script  for automated generating PNGs from templates filled with data from XML.

      Automated export fails. Get message "does not support this property or method PNG".

      What is wrong?

       

      function set_png_export_options() {

      with( app.pngExportPreferences ) {

      antiAlias = true;

      embedColorProfile = true;

      exportResolution =  72;

      exportingSpread = false;

      PNGColorSpace = PNGColorSpaceEnum.RGB;

      PNGExportRange = PNGExportRangeEnum.EXPORT_ALL;

      PNGQuality = PNGQualityEnum.HIGH;

      simulateOverprint = true;

      transparentBackground = true;

      useDocumentBleeds = true;

      }

      }

        • 1. Re: PNG Export Scripting?
          Kasyan Servetsky Level 5

          This works for me in CS6, Windows.

           

          main();
          
          function main() {
              var doc = app.activeDocument;    
              set_png_export_options();
              var file = new File("~/Desktop/test.png");    
              doc.exportFile(ExportFormat.PNG_FORMAT, file);
          }
          
          function set_png_export_options() {
              with(app.pngExportPreferences) {
                  antiAlias = true;
                  embedColorProfile = true;
                  exportResolution =  72;
                  exportingSpread = false;
                  PNGColorSpace = PNGColorSpaceEnum.RGB;
                  PNGExportRange = PNGExportRangeEnum.EXPORT_ALL;
                  PNGQuality = PNGQualityEnum.HIGH;
                  simulateOverprint = true;
                  transparentBackground = true;
                  useDocumentBleeds = true;
              }
          }
          
          • 2. Re: PNG Export Scripting?
            Dim48 Level 1

            Thank you!

             

            i have in Indesign CC this function:

             

            if (png_target_path != "") {

            var pngtarget = png_target_path + "/" + xname.replace(/xml$/, "png");

            set_png_export_options();

            doc.exportFile(

            ExportFormat.PNG_FORMAT,

            File(pngtarget),

            false

            );

            }

             

            This don't work with png: "Object does not support this property or method PNG".

            Why?

            • 3. Re: PNG Export Scripting?
              Kasyan Servetsky Level 5

              Unfortunately I don't have CC so can't test it.

              • 4. Re: PNG Export Scripting?
                Dim48 Level 1

                that works too with CS6