3 Replies Latest reply on Nov 22, 2011 6:47 AM by Loic.Aigon

    Script for printing changed pages only

    ashleeadobe1234

      Does anyone know of a script that will allow the printing of only those pages that have had changes made to them since a previous save? I'm a typesetter doing work only on books and journals and sometimes it's a bit tedious to keep track of the individual pages one works on. thanks,

        • 1. Re: Script for printing changed pages only
          Loic.Aigon Adobe Community Professional

          Hello,

           

          How any script may guess something changed ? What about helping it a bit ? You may consider an object on the pasteboard with some object style (background either green or red). Then if you edit teh page, you switch object style to red (meaning it has changed). Then a script can look for these items and print matching pages. Once print command run, the script can turn them again all to green.

          Loic

          • 2. Re: Script for printing changed pages only
            ashleeadobe1234 Level 1

            hi Loic

            interesting tactic, yes, i'm following you.  unfortunately, my scripting ability is preventing me from writing this so i'm just a seeker here, not an author. but thanks!

            • 3. Re: Script for printing changed pages only
              Loic.Aigon Adobe Community Professional

              Ok,

               

              Here is a raw code. All you need to do is edit the script to specify the printer preset you want to use. I don't have a printer my self to debug but I think it should work.

               

              Here is the idml to grab the object styles. Don't forget to apply on objects located onto the pasteboard. The script look for these objects and grab the page name next to them to finally print these pages.

               

              Hope it helps,

               

              Loic

               

              function main(){

               

               

                        var doc,

                        changedArray = [],

                        changedStyle,

                        unchangedStyle,

                        i=0,

                        max=0,

                        found = [],

                        pagerange = [];

                        obj,

                        vb,

                        leftPage,

                        leftPageBounds,

                        rightPage,

                        rightPageBounds,

                        pagerange = "";

               

                        if(!app.documents.length){ return; }

               

                        var doc = app.activeDocument;

                        changedStyle = doc.objectStyles.itemByName("changed");

                        unchangedStyle = doc.objectStyles.itemByName("unchanged");

               

                        if(!changedStyle.isValid ||  !changedStyle.isValid){

                                  alert("Problem with object styles. Script requires both \"changed\" and \"unchanged\" styles.");

                                  return;

                        }

               

               

                        app.findObjectPreferences.appliedObjectStyles = changedStyle;

                        found = doc.findObject();

               

                        max = found.length;

                        for(i=0; i<max; i++){

                                  obj = found[i];

                                  vb = obj.visibleBounds;

                                  leftPage = obj.parent.pages[0];

                                  leftPageBounds = leftPage.bounds;

               

                                  rightPage = obj.parent.pages[-1];

                                  rightPageBounds = rightPage.bounds;

               

                                  if(vb[1]>rightPageBounds[1]){

                                            pagerange.push(rightPage.name);

                                  }

                                  else if(vb[1]<leftPageBounds[1]){

                                            pagerange.push(leftPage.name);

                                  }

                        }

               

                        app.printPreferences.activePrinterPreset = app.printerPresets.itemByName("my printer preset");

               

                        var oldPrintPrefs = doc.printPreferences.pageRange;

                        doc.printPreferences.pageRange = pagerange.join(",");

               

                        alert("Gone printing");

                        app.print();

               

                        doc.printPreferences.pageRange = oldPrintPrefs;

              }

               

               

               

               

               

               

              main();