Change parentPage of a pageItem

Community Beginner ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

I am trying to write a script that splits an indesign spread into two separate pages. I turned off shuffling for page and spread, duplicated the spreead, and tried to delete the right page on the first spread (to be left with just the right) and the left page on the second spread, to be left with just the right. If there is an object that crosses the spine it gets deleted in the second instance. The parentPage property is set to the left page by default. Can this parent be changed, programatically, so that it is seen as belonging to the right page and therefore not lost?

TOPICS
How to, Scripting

Views

125

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

I don’t think so, the page item’s parentPage is read only.

 

The same problem happens if you try to split a spread’s pages via the UI, so if I’m understanding what you are trying to do, you’ll need to duplicate the crossover item and set the bounds to the two pages.

 

Screen Shot 21.png

 

 

Screen Shot 22.png

 

 

Here I copied the crossover, Paste in Place, and adjustment of the parent frames’ bounds

 

Screen Shot 23.png

 

 

 

 

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Thought of a work-around:

duplicate spread and delete right page of first spread

store current pasteboard dimensions

change current pasteboard top margin to 1.25 * page height

move all objects in spread up by 1.25 * page height

delete left page

move all objects in spread back down by  1.25 * page height

 

Did this manually and deleting left page no longer deleted the cross spine object.

 

Will post the script snippet if I can get it working.

Moving the objects instead of copy pasting them should avoid problems arising from changes in stacking order.

As a refinement I will probably later add a routine to move only objects that cross the spine so un-needed objects do not continue to live on the pasteboard.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Not sure I fully understand the problem yet (no coffee) but I think I would just create a new document with facing pages off and duplicate the parentPage to the new doc in order, and figure how to handle items that cross the spine.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Tim said: "…The parentPage property is set to the left page by default."

 

Hi Tim,

I don't think so. The value for parentPage is read-only and depends on some factors if you deal with facing pages documents. ( If the object is on the pasteboard the value is null. )

However, you could change the value of parentPage if you move an object.

 

Some empiric result from all my tests:

[1] Usually the center of an object dictates the value of parentPage when an object is crossing the spine.

[2] If the center of an object is exactly positioned on the spine: You may see rounding problems, so it could be left or right from the spine. If it is exactly positioned on the spine, then the page left from the spine is the winner.

[3] The value of parentPage can return a page object even if its parent object, e.g. a text frame where the object is anchored to, is positioned on the pasteboard.

 

Regards,
Uwe Laubender

( ACP )

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Do you think it would work if I moved every item over to the right by the width of the page, delete the left page, and move everything back? Any objects that do not cross the spine, and are deleted, shouldnt affect the final result. Am I on the right track?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

"Any objects that do not cross the spine, and are deleted, shouldnt affect the final result."

 

Hm, as I said in [3] this approach could be problematic.

 

Regards,
Uwe Laubender

( ACP )

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines