How to display page number of graphic?

New Here ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

Is there a way to display the PageNumString (Page Number) of parent Anchor Frame of a Graphic?

TOPICS
Scripting

Views

158

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

correct answers 1 Correct Answer

Adobe Community Professional , Sep 12, 2017 Sep 12, 2017
Here is a general-purpose function that will return the Page object of just about any object you pass to it:function getPage (obj) {        // Gets the page object that contains the object passed in.        var frame = 0, cell = 0;    var objType = "";        while (obj) {                frame = obj;        objType = obj.constructor.name;                switch (objType) {            case "Marker" :                obj = obj.TextLoc.obj;                break;            case "SubCol" :            ...

Likes

translate

Translate

Translate
Adobe Community Professional ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

Here is a general-purpose function that will return the Page object of just about any object you pass to it:

function getPage (obj) {

   

    // Gets the page object that contains the object passed in.

   

    var frame = 0, cell = 0;

    var objType = "";

   

    while (obj) {

       

        frame = obj;

        objType = obj.constructor.name;

       

        switch (objType) {

            case "Marker" :

                obj = obj.TextLoc.obj;

                break;

            case "SubCol" :

                obj = obj.ParentTextFrame;

                break;

            case "Tbl" :

                obj = obj.FirstRowInTbl.FirstCellInRow;

                break;

            case "Row" :

                obj = obj.FirstCellInRow;

                break;

            case "Cell" :

            case "Pgf" :

            case "AFrame" :

                obj = obj.InTextFrame;

                break;

            case "TextLine" :

            case "TextFrame" :

            case "UnanchoredFrame" :

            case "Arc" :

            case "Ellipse" :

            case "Group" :

            case "Inset" :

            case "Line" :

            case "Math" :

            case "Polygon" :

            case "Polyline" :

            case "Rectangle" :

            case "RoundRect" :

                if (obj.FrameParent.ObjectValid()) {

                    obj = obj.FrameParent;

                } else {

                    obj = 0;

                }

                break;

            default:

                // Prevent endless loop if unknown object type is found.

                obj = 0;

                break;

        }

    }

    if (frame) {

        return frame.PageFramePage;

    } else {

        return 0;

    }

}

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