Quantcast
Channel: Adobe Community : Popular Discussions - InDesign SDK
Viewing all articles
Browse latest Browse all 78596

How to sort page items by Z-Order

$
0
0

Hi

I was trying to sort page items on each page within InDesign according to their z order using the indesign SDK. I was using the API "GetItemsOnPage()" to retrieve the items on each page. However, this way, while I do get the page items sorted by z-order relative to each other within the same layer,  but the items are not sorted in z-order relative to each other across the layers.
Thus, lets say I have the following:

Layer 3 on top of Layer 2 on top of Layer 1

item 1 on layer 1

item 1.A on layer 1 (but "behind" item 1 in terms of Z -order)

item 2 on layer 2

item 3 on layer 3,

then when i use the API GetItemsOnPage(), I get the page items in the following order

item 3, item 2, item 1.A, item 1 --> Note: order of item 1A and item 1 is correct as 1A is behind 1. so within the same layer z order is preserved

  instead of

item 1A, item 1, item 2 , item 3

 

 

I am wondering if there is any way in which I can retrieve the page items in the z order in which they appear on the page regardless of the layer they are in. I tried to use the "Arranger" utility to see if that can sort the UIDList but it did not help either..

 

I would appreciate any help on this

 

thanks

Sam

========================================================================================== ===

Here is a snippet of what I am using..

            //get the pages in current spread
            UIDList pageItems( currentDocumentDataBase );
            int32 nPageCount = spread->GetNumPages();
            for(int32 nPageIndex = 0; ( (nPageIndex < nPageCount) && (nErrorVal == 0) ); nPageIndex++)
            {
                iterate all the objects on the page
                spread->GetItemsOnPage(nPageIndex, &pageItems, kFalse, kFalse);

           // The pageItems that I get using the above API are not sorted in z order  across layers. (within the same layer they are returned in the correct z order)


                int32 nNumOfPageItems = pageItems.Length();

 

 

....

 

...


Viewing all articles
Browse latest Browse all 78596

Trending Articles