Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to get all page items from the document

Guest
Mar 07, 2012 Mar 07, 2012

Hi all,

i want to get all page items and its frame and data from the document

Then i want to create my own xml.

any help? any advice ?please.

TOPICS
SDK
2.0K
Translate
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 Expert ,
Mar 07, 2012 Mar 07, 2012

Pageitems are owned by the spreadlayer, you can traverse the spread and get the pageitems from it. Please refer the SDK for examples.

The general way to do this is to traverse the IHierarchy interface of the parent object to get the children.

Manan Joshi

  - Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

Translate
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
Guest
Mar 07, 2012 Mar 07, 2012

Hi joshi,

i have tried the sample code for checking the possibilties ,

InterfacePtr<IApplication> application(GetExecutionContextSession()->QueryApplication());

    InterfacePtr<IDocumentList> documentList(application->QueryDocumentList());

    for (int32 i = 0; i < documentList->GetDocCount(); i++) {

        IDocument* document = documentList->GetNthDoc(i);

        UIDRef ref=::GetUIDRef(document);

        InterfacePtr<IHierarchy> hierarchy(ref, UseDefaultIID());       //issue,   hierachy is not getting created. it just retrun nil

        if (hierarchy == nil)

            break;

        int32 count=hierarchy->GetChildCount();

}

Translate
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 Expert ,
Mar 07, 2012 Mar 07, 2012

As i pointed out previously the owner of the Pageitems is spread layer and not the document, as far as i can recall IHierarchy won't exist on kDocBoss.

You need to go to the content layer of the document and then traverse its hierarchy. Have a look at the Layout Fundamentals in the programming guide.

Manan Joshi

  - Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

Translate
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
Guest
Mar 07, 2012 Mar 07, 2012

Hi, joshi can you suggest me any sdk samples to understand this

Translate
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
Mentor ,
Mar 07, 2012 Mar 07, 2012

For completeness sake you may  also want to cover "TOP" type on path and anchored page items.

Dirk

Translate
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
Explorer ,
Mar 30, 2012 Mar 30, 2012
LATEST

You also can iterate all of UIDs in doc’s database.

Have a look on IDataBase.h and there are several examples in the SDK.

Translate
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
Guest
Mar 08, 2012 Mar 08, 2012

Hi all,

i use the  following code  to get all pageitem and its path type .i am able to get all page item's UIDRef .but i am not able to get its path type.

please help me!

for (int32 nPage = 0; nPage < numberOfPages; nPage++ )

            {

                UIDList pageItemList(database);

                spread->GetItemsOnPage

                (

                 nPage,

                 &pageItemList,

                 kFalse,

                 kFalse

                 );

               

                // Iterate the page items and save off the UIDs of frames.

                bool16 hasContent;

                int32 pageItemListLength = pageItemList.Length();

                for (int32 j = 0; j < pageItemListLength; j++ )

                {

                    UIDRef pageItemRef = pageItemList.GetRef(j);

                    //InterfacePtr<IGraphicFrameData> graphicFrameData(pageItemRef, UseDefaultIID());

                    //hasContent =graphicFrameData->IsGraphicFrame();

                    InterfacePtr<IPathGeometry> pathGeometry(pageItemRef,UseDefaultIID());

                    if (pathGeometry != nil)

                    {

                       

                       

                        PMPageItemType pathType = Utils<IPathUtils>()->WhichKindOfPageItem(pathGeometry); // issue ,this statement is not return the path type

                        switch (pathType)

                        {

                            case kIsPoint:

                                break;

                            case kIsLine:

                                break;

                            case kIsSquare:

                                break;

                            case kIsRectangle:

                                break;

                            case kIsCircle:

                                break;

                            case kIsOval:

                                break;

                            case kIsPoly:

                                break;

                            case kIsPath:

                                break;

                            case kIsCompoundPath:

                                break;

                            default:

                                break;

                        }

                    }

            

                }

Translate
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
Enthusiast ,
Mar 08, 2012 Mar 08, 2012

Hi,

did you try it with IPageItemTypeUtils instead of IPathUtils?

Markus

Translate
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