How to preserve section when moving pages?
I need to sort pages in a document. All the pages start a section. When I move a page at the beginning the former page 1 does not start a section anymore. This is exactly like in the GUI. (And I consider this a bug.) In the GUI though the new page 2 still is marked as a section start and also the pageNumberStart is still correct. I only need to click on the radio button "Start page numbering at" (do not know the exact English wording) and everything is fine. The corresponding script command
mypage.appliedSection.continueNumbering=false;
however fails, as this will change the first page. I thought of just creating a new section and apply this to page 2 but this also does not work.
Then I thought I create a dummy page at the beginning do the sorting and remove dummy page. That looked promissing but also lead to nowhere.
This is the last try...
var mydoc=app.activeDocument;
var thepages=mydoc.pages;
var lownum=thepages[0].name*1;
var dummypage=mydoc.pages.add();
dummypage.move (LocationOptions.AT_BEGINNING);
var k=thepages.length;
for (j=1;j<k;j++)
{
var curid=j;
for (i=curid;i<k;i++)
{
var a=thepages;
var an=a.name;
if(a.name*1<lownum)
{
lownum=a.name*1;
a.move (LocationOptions.AFTER,thepages.item(curid-1));
}
}
}
dummypage.remove();
Any idea?
Thank you,
Ralf