2 Replies Latest reply on Apr 10, 2016 10:01 PM by b91823603

    Overriding PDF export preset settings without overwriting

    McShaman Level 1

      Is it possible to write a script to export a PDF using an export preset as the basis and then just overriding a couple of settings? A bit like you normals would if you were doing it manually i.e. selecting a preset like [High Quality Print] and then turning off/on options like bleed and crop marks.

       

      I thought something like this:

       

      var document = app.activeDocument;
      
      var targetPreset = app.pdfExportPresets.item(0); // [High Quality Print]
      
      targetPreset.pdfExportPreferences.useDocumentBleedWithPDF = true;
      targetPreset.pdfExportPreferences.cropMarks = true;
      
      var folder = Folder().selectDlg();
      
      var file = new File(folder + '/testfile.pdf');
      
      document.exportFile(ExportFormat.PDF_TYPE, file, false, targetPreset);
      

       

      But this actually modifies the [High Quality Print] preset. What I suppose I need to do is get the settings from the preset and copy them to the app.pdfExportPreferences settings and then run the export with out the preset argument.

       

      Anybody done this before?

        • 1. Re: Overriding PDF export preset settings without overwriting
          McShaman Level 1

          Well this appears to work! Anybody see a problem with me copying the properties from a PDFExportPreset object to the properties of the app.PDFExportPreferences object? The look about the same...

           

          var document = app.activeDocument;
          
          var highQualProperties = app.pdfExportPresets.item(0).properties; // [High Quality Print]
          
          app.pdfExportPreferences.properties = highQualProperties;
          app.pdfExportPreferences.useDocumentBleedWithPDF = true;
          app.pdfExportPreferences.cropMarks = true;
          
          var folder = Folder().selectDlg();
          
          var file = new File(folder + '/testfile.pdf');
          
          document.exportFile(ExportFormat.PDF_TYPE, file, false);
          
          • 2. Re: Overriding PDF export preset settings without overwriting
            b91823603 Level 3

            Hi McShaman,

             

            You can try like this,

             

            var document = app.activeDocument; 

            app.pdfExportPreferences.useDocumentBleedWithPDF = true; 

            app.pdfExportPreferences.cropMarks = true; 

             

            var folder = Folder().selectDlg(); 

             

            var file = new File(folder + '/testfile.pdf'); 

            var targetPreset = app.pdfExportPresets.item(0); // [High Quality Print] 

            document.exportFile(ExportFormat.PDF_TYPE, file, false, targetPreset);