6 Replies Latest reply on May 11, 2014 7:18 PM by m8r-vrpa5v

    Import and Update PDF Export Preset

    m8r-vrpa5v

      Hey there again!

       

      I'm now trying to define a preset for the PDF Export process... it's based on the "High Quality Print" (from the Adobe PDF Preset list), and then I want to change "one or two" parameters.

      Changing one or two parameters is easy, I've been doing that already, but since most of them are already defined by the "High Quality Print" Preset, my idea was:

      1. Load the "High Quality Preset"
      2. And after that change the required parameters
      3. And then export to PDF of course!

       

      How can this be done?

       

      Many thanks!!

      Best regards.

        • 1. Re: Import and Update PDF Export Preset
          m8r-vrpa5v Level 1

          I've made some progress... or maybe not.

           

          I've loaded the "High Quality Print" preset to an object, then tried to change that object in a few parameters...

          ...at that point I get a message telling me that the folder may be protected, maybe it's the object that it's not supposed to be changed?

           

           

          Here's the code I've used:

          myPDFExportPreset=app.pdfExportPresets.item("[High Quality Print]");

           

           

           

          // ----------------------------- GENERAL----------------------------------

              //pdfExportPresets - exportReaderSpreads=On

              myPDFExportPreset.exportReaderSpreads=true;

          // ----------------------------- GENERAL----------------------------------

           

           

           

          // ----------------------------- COMPRESSION----------------------------------

          // ----------------------------- COMPRESSION----------------------------------

           

           

           

          // ----------------------------- MARKS and BLEED----------------------------------

              //pdfExportPresets - cropMarks=On

              myPDFExportPreset.cropMarks=true;

              //pdfExportPresets - useDocumentBleedWithPDF=On

              myPDFExportPreset.useDocumentBleedWithPDF=true;

              //pdfExportPresets - BleedSettings=T0mm T0mm I0mm O0mm

              bleedTop='0mm';

              bleedBottom='0mm';

              bleedInside='0mm';

              bleedOutside='0mm';

              //pdfExportPresets - includeSlugWithPDF=On

              myPDFExportPreset.includeSlugWithPDF=true;

          // ----------------------------- MARKS and BLEED----------------------------------

           

          Can anyone spot what's the problem in here? How can I change that preset?

          Many thanks again.

          • 2. Re: Re: Import and Update PDF Export Preset
            Jump_Over Level 5

            Hi,

             

            There are two location of pdfExportPresets basically:

             

            app Folder -  "/c/ProgramData/Adobe/Adobe%20PDF/Settings/presetName.joboptions"

            user Folder -  "~/AppData/Roaming/Adobe/Adobe%20PDF/Settings/presetName.joboptions"

             

            You are able to modify 2nd ones or to duplicate 1st ones (copy from app Folder goes to user Folder).

             

            So 1st step is to duplicate some app preset to user folder (let say changing its name)

            and call this copy as a one to be modified by script.

             

            To duplicate use this:

            currPreset = app.pdfExportPresets.item("[High Quality Print]").duplicate();
            currPreset.name = "myHResPreset";
            
            

             

            After this you can modify your script's 1st line:

            myPDFExportPreset=app.pdfExportPresets.item("myHResPreset");
            
            
            

             

            and run your code

             

            Jarek

            • 3. Re: Re: Import and Update PDF Export Preset
              Laubender Adobe Community Professional & MVP

              @m8r-vrpa5v – I think, it is not best practice to change a default PDF Export Preset. Instead I would add a new preset based on the default one.

               

              When looking at your code you have to use the right syntax.

              Every time you assign a value to a property you have to use the right object that property belongs to.

              Some values are only functional, if some other property is set (this goes especially for the bleed settings).

               

              Do not write:

               

              bleedTop='0mm';
              

               

              ExtendScript cannot know by itself where this property and its value should be assigned to what object.

               

              Right syntax would be:

               

              myPDFExportPreset.bleedTop='0mm';
              

               

              Or (I used no meassurement units, the value 0 does not require this):

               

              myPDFExportPreset.properties = {
              
              useDocumentBleedWithPDF : true,
              bleedTop : 0 ,
              bleedBottom : 0 ,
              bleedInside : 0 ,
              bleedOutside : 0
              
              }
              

               

              Here a link to an ExtendScript resource that will tell you (nearly) everything about objects, methods, properties and values you can use:

               

              Jongware

              InDesign JavaScript Reference Guide

              http://www.jongware.com/idjshelp.html

               

              The chm-files are best for searchability.

               

              Uwe

              • 4. Re: Import and Update PDF Export Preset
                m8r-vrpa5v Level 1

                Jump_Over wrote:

                 

                Hi,

                 

                There are two location of pdfExportPresets basically:

                 

                app Folder -  "/c/ProgramData/Adobe/Adobe%20PDF/Settings/presetName.joboptions"

                user Folder -  "~/AppData/Roaming/Adobe/Adobe%20PDF/Settings/presetName.joboptions"

                 

                You are able to modify 2nd ones or to duplicate 1st ones (copy of app Folder goes to user Folder).

                 

                So 1st step is to duplicate some app preset to user folder (let say changing its name)

                and call this copy as a one to be modified by script.

                 

                To duplicate use this:

                1. currPreset = app.pdfExportPresets.item("[High Quality Print]").duplicate(); 
                2. currPreset.name = "myHResPreset"

                After this you can modify your script's 1st line:

                1. myPDFExportPreset=app.pdfExportPresets.item("myHResPreset"); 

                 

                and run your code

                 

                 

                AaaaaaaaaaaaH!!!! Thanks Jump_Over... I think that's the thing I was missing.

                 

                I'll try it later when I get home and I'll tell the result.

                But I think that's exactly what I've needed.

                • 5. Re: Import and Update PDF Export Preset
                  m8r-vrpa5v Level 1

                  Uwe Laubender wrote:

                   

                  @m8r-vrpa5v – I think, it is not best practice to change a default PDF Export Preset. Instead I would add a new preset based on the default one.

                   

                  When looking at your code you have to use the right syntax.

                  Every time you assign a value to a property you have to use the right object that property belongs to.

                  Some values are only functional, if some other property is set (this goes especially for the bleed settings).

                   

                  Do not write:

                   

                  1. bleedTop='0mm'

                   

                  ExtendScript cannot know by itself where this property and its value should be assigned to what object.

                   

                  Right syntax would be:

                   

                  1. myPDFExportPreset.bleedTop='0mm'

                   

                  Or (I used no meassurement units, the value 0 does not require this):

                   

                  1. myPDFExportPreset.properties = { 
                  2.  
                  3. useDocumentBleedWithPDF : true
                  4. bleedTop : 0
                  5. bleedBottom : 0
                  6. bleedInside : 0
                  7. bleedOutside : 0 
                  8.  

                   

                   

                  Hi Uwe,

                   

                  Thanks for your remark... that was my mistake when using copy paste.

                  I was reusing code from another script where I used the WITH function, in here I was using a different structure and I didn't correct this.

                   

                  But thanks again for the remark!

                  • 6. Re: Re: Re: Import and Update PDF Export Preset
                    m8r-vrpa5v Level 1

                    Hi there Jump_Over,

                     

                    I had a "little" delay trying your solution... but here I am.

                    Just tested it and it worked like a million bucks!!

                     

                    Thanks for the help!