2 Replies Latest reply on Apr 11, 2012 6:04 AM by Brian.T.Tanner

    [JS CS5] page.duplicate mixed page orientations/sizes does not cause shuffle

    Brian.T.Tanner Level 1

      This is a problem that I can reproduce in the GUI so it is probably a "feature" not a bug. However, I can't figure it out.


      If I setup a standard document with spreads of 2 pages each, facing pages, it is literally impossible (as far as I can tell) to accidentally create a 3-page spread by dragging one page between two others.  This is a good thing, and is why we have page shuffling turned on, right?!


      If you turn page shuffling off, all bets are off and you can drag a 3rd page between two others in a spread and chaos ensues. I'm joking, because you might want that sometimes, but sometimes you don't.  I don't.


      Ok, so here is the problem.  Create a new document and add a few pages.  Now assign a custom page size to one of the pages. Now try and stick the weird page between two normal pages in a spread. It goes right in, and now you have a 3 page spread.  Thankfully you are using the GUI and you can just fix this silliness manually.


      My problem is I am trying to duplicate some landscape pages into my document using a script, and pages are not automatically shuffling.  So I get these ugly spreads that have many pages and the pageSide options (left or right facing pages) is not behaving in a natural way.  I am currently doing something like:


      var newPage=pageFromOtherDocument.duplicate(LocationOptions.AFTER, currentPage);


      I have also tried doing something like:

      var newPage=pageFromOtherDocument.duplicate(LocationOptions.AFTER, currentPage.parent);


      currentpage.parent *should* be a spread so this should work, but it doesn't, it just gives me a *beep* and the word "duplicate" in the status box in the extendScript editor.


      I have also tried duplicating it into the document and then moving it into the next spread using:

      newPage.move(LocationOptions.AFTER, currentPage.parent);


      This does not give me an error but the spread (currentPage.parent.pages.length) is still 3 and the problem is still visible.


      I've been banging my head against the desk with this for about 5 hours now.  Any tips?

        • 1. Re: [JS CS5] page.duplicate mixed page orientations/sizes does not cause shuffle
          Laubender Adobe Community Professional & MVP

          @Brian – Fisrt an observation: in the UI it's the same behaviour. You cannot move a page to a spread with the move command. You just have to drag it there.


          See the following example. It shows the state of the pages after you tried to move another page from a different document to spread 2 (this should be similar to your situation). Page 4 is the new page transferred to the document:




          Page 4 should stay with page 3 in the same spread.


          Try the following script snippet which moves page 4 after page 3 in the same spread:


          var d = app.documents[0];


          It sounds silly doing that, because page 4 is already ordered after page 3, but look at the result:





          • 2. Re: [JS CS5] page.duplicate mixed page orientations/sizes does not cause shuffle
            Brian.T.Tanner Level 1

            I would be interested to see what the outcome would be if you had all the pages set to shuffle.  I think in that case you might actually get the behaviour I want. Also to move after a spread it seems like you should be able to set the destination reference to d.pages[2].parent to target the spread instead of the page as the destination.


            In any case I found an easy, obvious, but initiall counterintuitive fix.  All I want to do is use landscape pages.  So, instead of changing that using the page tool or changing the paper size, I just rotate all my content and use regular old pages.  Now I get the desired behaviour with my existing code. Seems in some ways like a workaround, but I'm happy to be able tomove on.


            Thanks for your interest and attention, I appreciate it!