6 Replies Latest reply on Jul 14, 2017 3:04 PM by stefanieh33937374

    Export PDF into multiple locations?


      Lets say your working off your desktop and have an inDesign file named 1350.indd you also have two servers with a folder named 1350. Is it possible to export a pdf and have it save on the server, in the folders of the filename of the indesign document?


      So it would go,


              Desktop - 1350.indd

      Server 1            Server 2

      1350 Folder      1350 Folder

      1350.pdf            1350.pdf


      Another layer which I don't think is possible but if it looks on the server and doesn't see a 1350 folder, could it create one and then save the pdf inside that?

        • 1. Re: Export PDF into multiple locations?
          BSKTCreation Level 2



          Try this.


          var documentName = app.activeDocument.name;
          var servers = [];
          // Push the server addresses here, you can have as many as you want
          servers.push(Folder("/c/InDesign Files"));
          servers.push(Folder("/d/InDesign Files"));
          for (var i = 0; i < servers.length; i++) {
              var folderLocation = servers[i] + "/" + documentName.substring(0, documentName.length - 5);
              try {
                  exportPDF(documentName, folderLocation);
              catch(error) {} // Don't do anything if the path doesn't exist
          function exportPDF(fileName, filePath) {
                   pageRange = PageRange.allPages;
                   acrobatCompatibility = AcrobatCompatibility.acrobat5;
                   exportGuidesAndGrids = false;
                   exportLayers = false;
                   exportNonPrintingObjects = false;
                   exportReaderSpreads = false;
                   generateThumbnails = false;
                   try {
                       ignoreSpreadOverrides = false;
                   catch(error) {}
                   includeBookmarks = true;
                   includeHyperlinks = true;
                   includeICCProfiles = true;
                   includeSlugWithPDF = false;
                   includeStructure = false;
                   interactiveElementsOption = InteractiveElementsOptions.doNotInclude;
                   subsetFontsBelow = 0;
                   colorBitmapCompression = BitmapCompression.zip;
                   colorBitmapQuality = CompressionQuality.eightBit;
                   colorBitmapSampling = Sampling.none;
                   grayscaleBitmapCompression = BitmapCompression.zip;
                   grayscaleBitmapQuality = CompressionQuality.eightBit;
                   grayscaleBitmapSampling = Sampling.none;
                   monochromeBitmapCompression = BitmapCompression.zip;
                   monochromeBitmapSampling = Sampling.none;
                   compressionType = PDFCompressionType.compressNone;
                   compressTextAndLineArt = true;
                   cropImagesToFrames = true;
                   optimizePDF = true;
                   bleedBottom = app.activeDocument.documentPreferences.documentBleedBottomOffset;
                   bleedTop = app.activeDocument.documentPreferences.documentBleedTopOffset;
                   bleedInside = app.activeDocument.documentPreferences.documentBleedInsideOrLeftOffset;
                   bleedOutside = app.activeDocument.documentPreferences.documentBleedOutsideOrRightOffset;
                   if(bleedBottom == 0 && bleedTop == 0 && bleedInside == 0 && bleedOutside == 0) {
                       bleedMarks = true;
                   else {
                       bleedMarks = false;
                   colorBars = true;
                   colorTileSize = 128;
                   grayTileSize = 128;
                   cropMarks = true;
                   omitBitmaps = false;
                   omitEPS = false;
                   omitPDF = false;
                   pageInformationMarks = true;
                   pageMarksOffset = 12;
                   pdfColorSpace = PDFColorSpace.unchangedColorSpace;
                   pdfMarkType = 1147563124;
                   printerMarkWeight = PDFMarkWeight.p125pt;
                   registrationMarks = true;
                   try {
                       simulateOverprint = false;
                   catch(error) {}
                   useDocumentBleedWithPDF = true;
                   viewPDF = false;
              var filePathWithPDF = filePath + "/" + fileName + ".pdf";
              var newFile = new File(filePathWithPDF);
              app.activeDocument.exportFile(ExportFormat.pdfType, newFile, false);



          • 2. Re: Export PDF into multiple locations?
            ssemmes Level 1

            Thank you Brett,


            Unfortunately I can't get the script to run, but I'm also not receiving any errors.

            Steps I took:

            • Copied your script into Adobe ExendedScript Toolkit.
            • Added the server path in.
            • servers.push(Folder("smb://pbosfile04/SHARED/Project management (job files)/My Name"));
            • servers.push(Folder("smb://pbosfile04/Shared_Creative")); 
            • Saved as .jsx and and placed in InDesign CC scripts panel in the applications folder.
            • Created a new document on my desktop, name it test.indd
            • Right clicked and hit run script in script panel
            • Nothing happens. - Was hoping to see test.pdf in both folders on server but no luck.
            • I also tried creating a folder on the server with the same name as my local file and it did not save either.
            • I also tried reversing the / to \ since it's a windows(PC) server and I'm on a mac. But it still did not run, not sure if that matters or not.


            I appreciate the time you've already taken. If you have any advice, maybe I'm not executing it properly, it's much appreciated.


            Thanks again,


            • 3. Re: Export PDF into multiple locations?
              BSKTCreation Level 2

              Hi Shawn,


              The path must be formatted slightly different and because of the "try" function in my script it will skip errors.


              Give this a go:




              I'm not 100% sure this is the right path for you but it should look something similar.



              • 4. Re: Export PDF into multiple locations?
                ssemmes Level 1

                Thanks Brett. I'm going to look into our servers, I have a feeling I don't have the full path, or there's a permissions error. Would periods in the path effect the way the script was written?


                Something like //smb/pbosfile04.prd.domain.com/Shared_Creative


                I'm also getting Result: undefined in the Javascript Console, if that's helpful.

                • 5. Re: Export PDF into multiple locations?
                  BSKTCreation Level 2

                  Hi Shawn,


                  Periods are fine, good work.



                  • 6. Re: Export PDF into multiple locations?

                    Did this ever get resolved?