Accessing page number property [CS3] [JS]

I am trying to find a way to access page numbers from a JavaScript program. Pages can always be accessed by their number (e.g., currentDocument.pages.item(0) references the first page). I have several documents (not gathered as a book) that have their page numbers set to start at different numbers. For instance, one document begins its page numbering at 100. That page 100 is still accessed by currentDocument.pages.item(0), since it is still the first page of the document.
My question is this: is there a way for the script to determine what the actual page number is for any given page? I need this number to insert as an attribute for an XML element that will mark the beginning of new pages in the print version so that citations can be created from the digital version. It seems like it should be something simple like myPage.pageNumber, but I haven't been able to find a property like this in any of the scripting references or any discussion of this issue in the forums.
There has to be an obvious answer, but somehow it is eluding me.
Kevin

Thank you. I knew it had to be obvious. I saw the name property, but since it returned a string I didn't think that was it. The script is now doing exactly what I wanted.
Kevin

Similar Messages

  • How to get the Page Number in CS3 with VB?

    Hi, Everybody
    I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
    For myStoryCounter = 1 to Document.Stories.Count
    Set myStory = Document.Stories.Item(myStoryCounter)
    For myWordCounter = 1 to myStory.Words.Count
    Set myWord = myStory.Words.Item(myWordCounter)
    myWordContents = myWord.Contents
    Rem ** How to Get the Page Number according to the Word ***
    Next
    Next

    > But I don't understand why Item(1) are set.
    because Word can have more than one parent TextFrame - when split across TextFrames
    only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)
    > why Story.TextFrames.Count alway is 0, Is it bug?
    no - it's not bug
    in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
    but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
    in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame
    robin
    www.adobescripts.com

  • [JS][CS3] Getting Page Number

    Hi.
    I need to find the page number of the page containing a frame.
    Normally I would use "myFrame.parent.name" to find the page number. However, I cannot use this method on an inline graphic.  What I get returned is the story, which has no page number.  I have used various ways, such as:
    myFrame.parent.insertionPoints[0].parent
    but nothing returns the page number.  I have looked at all the properties of the frame, and cannot find a property I can manipulate to extract the page number.
    Is this possible? Should I give up now?
    Cheers
    Roy

    Here is a function written by Dave Saunders:
    var myDoc = app.activeDocument;
    var myObj = app.selection[0];
    $.write("The selected object is on page " + findPage(myObj).name + "\n") ;
    function findPage(theObj) {
        var thePage = theObj;
        if (thePage.hasOwnProperty("baseline")) {
          thePage = thePage.parentTextFrames[0];
        while (thePage.constructor.name != "Page") {
          var whatIsIt = thePage.constructor.name;
          switch (whatIsIt) {
            case "Story" :
              thePage = thePage.textFrames[-1].parent;
              break;
            case  "Character" :
              thePage = thePage.parentTextFrames[0];
              break;
            case "Cell" :
              try {
                thePage = thePage.insertionPoints[0].parentTextFrames[0];
                break;
              } catch (e) {
                // must be overset, so ignore
                return null;
            case "Application" :
              // must be off page, so ignore
              return null;
          thePage = thePage.parent;
        return thePage

  • Page rotate script not working(not allowed error security settings prevent access to this property)

    HI,
    I am using a script to rotate each pages in pdf file when clicking a button. I have added a script to rotate file in the rotate button's click event as a javascript.It is working in acrobat but not in adobe reader. Pleae see the script
    nStart = 0;
    nEnd = this.numPages - 1;
    nRotate = 90;
    try
    if (this.numPages > 0)
               this.setPageRotations(nStart , nEnd , nRotate)
    catch(e)
    app.alert("Processing error: "+e)
    But I'm getting this  error in adobe reader not in acrobat.'not allowed error security settings prevent access to this property or method'. What is the problem. Please anybody tell me.

    OK, so here's what you do:
    - Create a new file in a plain-text editor (I recommend Notepad++), and paste this code into it:
    safeExecMenuItem = app.trustPropagatorFunction(function(code){
        app.beginPriv();
        app.execMenuItem(code);
        app.endPriv();
    mySafeExecMenuItem = app.trustedFunction(function(code){
        app.beginPriv();
        safeExecMenuItem(code);
        app.endPriv();
    Close Reader if it was open and then save this file as "MyScripts.js" and place it in the following directory (this is for Windows):
    C:\Program Files (x86)\Adobe\Reader 11.0\Reader\Javascripts
    If you want it to work in Acrobat as well place the file also under:
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts
    Now to rotate the pages clockwise attach this code to your button (in Acrobat, of course):
    mySafeExecMenuItem("RotateCW");
    And to rotate them counter-clockwise, use this code:
    mySafeExecMenuItem("RotateCCW");
    Open your file in Reader and the buttons should rotate the pages when clicked...

  • Incorrect number of subscript accessing external object property loadfile in open event

    Hi
    I used  the following method to  view pdf  OLE Object Control -> Insert Control -> Then I select Adobe pdf reader. After that I wrote the following script in the open event of the form
    ole_1.object.loadfile("H:\document\empdoc.pdf") . But when I run the application the following error is coming
    "Incorrect number of Subscript Accessing external object property loadfile in open event" please can u help.
    With Thanks
    Pol

    Hi Polanchan,
    I've tried the following code in both PB 11.2 and 12.6 on Windows 7 and I do not see the error message you are seeing.
    string ls_filename
    ls_filename = "my.pdf"
    ole_1.object.LoadFile(ls_filename)
    What version of Acrobat Reader do you have on your machine?  I have version 10.1.13.
    Patricia Steinhardt
    SAP Active Global Support

  • Flash CS3 Compiler in Strict Mode errors out 1120: Access of undefined property

    Hi,
    I am following a code example in a book and have the final fla and as files, so I know the project works when fully coded.
    This is my problem:
    In the book, it tells me I can test the movie to make sure that it is working so far. When I do that, I get the error 1120: Access of undefined property.
    The "property" is a component instance. If I take the example completed code and remove everything up to the point I am at, I receive the same errors, so I know it's not a spelling/syntax mistake.
    I have a feeling it is the Compiler in Strict Mode. But, when I change it to Standard Mode, then I get error 5001: The name of package 'com.foundastionAS3.ch12' does not reflect the location of this file. etc.
    So, in the end, I feel if I can't check my code until everything is completely finished, how do I check it as I am working?
    Can someone help?
    Thanks.
    note:: attached is a file of the compiler when it gives me multiple 1120s.

    It's funny. I checked the code from the book, it does not have it imported, but it still works. When I complete the code without the import, it works.
    When I do add the import (which is the first thing I did when the errors were thrown) while building the code, it removes that error, but the same 1120's are there. I checked the properties of the components to make sure they are runtime, and also the properties of the actionscript is runtime, so what is it?
    All of the more complex examples in the book are throwing these errors while building the code. The problem is, how do I check my code while creating it... That's why when I found this post "http://forums.adobe.com/message/2844566#2844566" I replied.

  • Which variable gives the Total Page Number in a report

    Which variable of Report can give me the total number of Pages. I want this information on first page itself. I want to refer this value in pl/sql thus i want to access the value programatically, and not just show in report as Page 1 of 10.
    Thanks,
    Sudhanshu

    This may help you! This is straight from the Help in Reports! More about this can be found by searching for Physical PAges in Reports Help!
    Suppose that you want to have the page number at the top of each page of your report. Furthermore, you want the page number to be of the form "Page n of m pages":
    1 Create a field named F_PAGE and set the Source property to &Physical Page Number.
    2 In the Field Property Palette, set the Page Numbering property by filling out the Page Numbering dialog box as follows:
    -Check Main Section and uncheck Header Section and Trailer Section because you only want to number the Main Section pages.
    -Type 1 in the Start At setting.
    -Type 1 in the Increment By setting.
    -Type &Report under Reset At because you don't want the page numbers to reset to zero until the report is done.
    3 Create a field called F_TOTPGE and set the Source property to &Total Number of Physical Pages.
    4 Do either of the following:
    -Hide these fields (i.e., set the Visible property to No) and reference them within boilerplate text:
    Page &F_PAGE of &F_TOTPGE
    -Alternatively, position F_PAGE and F_TOTPGE beside each other. Insert boilerplate to the left of F_PAGE that contains the text "Page". Insert boilerplate between F_PAGE and F_TOTPGE that contains the text "of".
    null

  • Error, please help? 1120: Access of undefined property event

    I have ActionScript 3 in two frames of my piece. In this 2nd frame, I get an error: "1120: Access of undefined property event" for "myXML=XML(event.target.data);" Can anyone help? I am not sure how to fix this.
    var myloader:URLLoader=new URLLoader();
    myloader.dataFormat=URLLoaderDataFormat.VARIABLES;
    myloader.addEventListener(Event.COMPLETE, guestBookWriteFunc);
    function guestBookWriteFunc(e:Event):void{
              var loader:URLLoader=URLLoader(e.target);
              var vars:URLVariables=new URLVariables(loader.data);
              var url:String="makexml.asp";
                   var sendloader:URLLoader=new URLLoader();
                   var request:URLRequest=new URLRequest(url);
                   trace("xml page created");
    var urlRequest:URLRequest=new URLRequest("makexml.asp");
    var urlLoader:URLLoader=new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, fileLoaded);
    urlLoader.load(urlRequest);
    //Setting up the XML
    var myXML:XML=new XML();
    myXML.ignoreWhitespace=true;
    var xmlList:XMLList;
    //Setting up the data holder Arrays
    var theUserName:Array=new Array();
    var theUserEmail:Array=new Array();
    var theUserComment:Array=new Array();
    function fileLoaded(e:Event):void{
         myXML=XML(event.target.data);
         xmlList=myXML.children();
         for (var i:int=0; i<xmlList.length(); i++){
              var xmlName:String=xmlList[i].username;
              var xmlEmail:String=xmlList[i].useremail;
              var xmlComment:String=xmlList[i].usercomment;
              theUserName.push(xmlName);
              theUserEmail.push(xmlEmail);
              theUserComment.push(xmlComment);
              if(i==xmlList.length()-1){
                   updateText();
    //Populating the text field to display messages
    var maximumMessages:Number=5;
    var currentMessages:Number=0;
    function updateText(){
         guestText.htmlText="";
         for (var i=currentMessages; i<maximumMessages; i++){
                   guestText.htmlText+=("<b><u>Name:</u></b>" + theUserName[i]);
                   guestText.htmlText+=("<b><u>Email:</u></b>" + theUserEmail[i]);
                   guestText.htmlText+=("<b><u>Comment:</u></b>" + theUserComment[i]);
                   guestText.htmlText+=(".................................");
                   currentMessages=i;
                   myScroller.scrollTarget=guestText;

    You are more likely to get a reply if you ask in the Flash or ActionScript forum.

  • Crystal Report Crosstab Page Number Issue

    Hi Gurus,
    I am creating the crystal report which has variable column fields, so the number of pages are variable.
    The issue is, When i place the page number on the footer, It display only at the end of the page saying '1 of 1', I read lot of forums regarding this issue but didn't get resolved yet.
    My crosstab is in the report header, I even tried the dummy group and placed the cross tab in that group. In that case i am getting '1 of 1' in all the pages.
    Can you guys please help me to resolve this issue
    Thanks
    Vijay

    Hi Vijay,
    Try this Knowledge base article :  It works for all cr versions
    Symptom
    In Crystal Reports (CR) 9, a cross-tab needs to have page numbers for its virtual pages in the format:
    "1", "1-1", "1-2", and so on.
    How can the virtual pages of a cross-tab be numbered?
    Resolution
    Virtual pages can be numbered by conditionally formatting the 'Display String' property of a Cross-Tab field.
    Displaying Page Numbers in Cross-Tab Virtual Pages
    1. Right-click the top-left of a cross-tab and click 'Cross-Tab Expert'.
    2. In the 'Cross-Tab Expert' dialog box click the 'New Formula' button, then name the formula 'Page Number'.
    3. In the Formula Editor enter a blank space (" ") then click the 'Save' button. Close the 'Formula Editor' dialog box.
    4. In the 'Cross-Tab Expert' dialog box select this formula from the 'Available Fields' box and move it to the 'Columns' box. Use the 'Up' arrow for the 'Columns' box to move it to the top of this box.
    5. Click the 'OK' button to close the 'Cross-Tab Expert' dialog box.
    6. Right-click the 'Column #1 Name' field on the cross-tab and click 'Format Field'. The 'Format Editor' dialog box will appear.
    7. On the 'Common' tab click the 'X+2' button next to 'Display String'.
    8. Enter the following formula in the 'Format Formula Editor':
    global numbervar PageNum;
    PageNum:= PageNum + 1;
    if PageNum > 1 then "Page # " + totext(pagenumber,0) + "-" + totext(PageNum - 1,0)
    else "Page # " + totext(pagenumber,0)
    9. Click the 'Save and Close' button to close the 'Format Formula Editor' then click the 'OK' button to close the 'Format Editor' dialog box.
    When previewing the report, the cross-tab will display "1" for the first page and then "1-1, 1-2" and so on, for the subsequent virtual pages. Navigating to page 2 will show "2" for the first virtual page followed by "2-1, 2-2" and so on.
    Background
    'Virtual pages' are the pages on a cross-tab from left to right as opposed to the actual pages that are accessed through the 'Navigation' buttons.
    When you create a cross-tab that is wider than the specified page size, CR automatically spans the printing across enough pages to accommodate the width of the cross-tab. In the Preview tab, a line will appear at each page break.

  • How to get  selected item page number?

    I am developing the plug-in for moving page item from one page to another page,for that i need selected item page number.i.e. i need the page number
    which the item is selected.

    Just access the 'currentCountry' property in the action method.
    public void submit() {
        System.out.println("JSF has already set the property: " + currentCountry);
        // Now do your thing with it. E.g. saving it or so.
        countryDAO.save(currentCountry);
    }

  • Page number to get displayed only when the page count is more than 1

    Hi Gurus,
    My requirement is to print page numbers ONLY if the page count is more than 1 ,i.e. if the data getting displayed in 1 page only then don't print "Page n of m" but if it is getting displayed in more than 1 page then display "Page n of m" on TOP right corner.
    I selected "Page n of m" and it creates 3 fields in object hierarchy i.e TextField CurrentPage, TextField PageCount and Static Text field Pages.
    I go to the ready:layout of PageCount object, and use below script:
    this.rawValue = xfa.layout.pageCount(); 
    if (this.rawValue == 1) {
    this.parent.Pages.presence     = "invisible";
    I looked at the message Page number not to display but it doesnot resolve my problem.
    Please help me out.
    Regards
    Ajay

    Hello Ajay,
    Script do not work for TextFields.  to get the page numbers displayed.  Select Text field from library and Go to Object Pallete, Value tab and select "Calculated - Read Only" in Type and choose Runtime property.  There you can find the Number of Pages.
    Once this is the text field, you can write script on it. 
    If(this.rawValue == 1)
      this.presence = "invisible"
    similarly write script for total number of pages, but make sure that variable is accessed properly.
    Please let me know, if you still see some issues with it.
    Thanks,
    Rakesh

  • ?fo:page-number? in if statement in the header section

    Hi,
    is it possible to put the <?fo:page-number?> in if statements??
    like <?if:fo:page-number>1?>STOP<?end if?>
    i have a requirement that the column should not be displayed in the succeeding page except for page 1. also the column have the table property REPEAT AS HEADER ROW.
    example:
    Page 1
    DOG
    CAT
    RAT
    FISH
    PAGE 2
    CAT
    RAT
    FISH
    PAGE 3
    CAT
    RAT
    FISH
    thanks, and i hope im able to explain well my problem . . .

    Hi,
    Did u try using the MS Word native functionalit --Option : Different First page –header option or Different Odd & Even Pages.
    hopefully this will help you to achieve your requirement.
    Regards
    Ravikumar Reddy
    +971 56 106 2436

  • Print tpage number/total page number in a report with width more than 240

    Dear all,
    I need to display total page number as following code sample.
    But I need to put it after position 240.
    this program can print total page number if   it is placed at postion 239 or before.
    WRITE: /234(10) 'Heading',  239 SY-PAGNO,'of ', '-----'.
    Whenever I put  240 or more WRITE: /234(10) 'Heading',  240 SY-PAGNO,'of ', '-----'.
    Total page num could not be displayed.
    Please tell me the solution.
    thanks
    REPORT YPAGECOUNT NO STANDARD PAGE HEADING LINE-SIZE 276  LINE-COUNT 65.
        DATA L_PAGE_COUNT(5) TYPE C.
    TOP-OF-PAGE.
      WRITE : /234(10) 'PAGE', SY-PAGNO,'/ ','-----', ''.
       WRITE: /234(10) 'Heading',  239 SY-PAGNO,'of ', '-----'.
        ULINE.
    START-OF-SELECTION.
      Real list output takes place here
        DO 1000 TIMES.
            WRITE: / 'Line #', SY-LINNO.
        ENDDO.
      Page count will be printed on each page here
        WRITE SY-PAGNO TO L_PAGE_COUNT LEFT-JUSTIFIED.
        DO SY-PAGNO TIMES.
            READ LINE 1 OF PAGE SY-INDEX.
            REPLACE '-----' WITH L_PAGE_COUNT INTO SY-LISEL.
            MODIFY CURRENT LINE.
        ENDDO.

    Using Values Greater than 255 for the LINE-SIZE of a List
    If you define a fixed column width greater than 255 using the LINE-SIZE addition in the REPORT or NEW-PAGEstatement, the following notes apply:
    Type definitions: The type group SLIST defines the valid maximum value for the list width (SLIST_MAX_LINESIZE), and contains a type for list lines with maximum width (SLIST_MAX_LISTLINE).
    Accessing the entire contents of a line: To read or modify the entire contents of a wide line, you can use the ... LINE VALUE addition in the READ LINE or MODIFY LINE statements. This is an alternative to using SY-LISEL that is independent of the attributes of the system field (since the length of SY-LISEL is 255 characters).
    Horizontal lines: With extra-wide lists, the "ULINE." statement corresponds to "WRITE / SY-ULINE.". So, for example, "ULINE AT 5(300)." corresponds to "WRITE AT 5(300) SY-ULINE.".
    Output length: You can use the length specification in WRITE (or ULINE) to extend the output length of an extra-wide list up to the value of LINE-SIZE. If you want to output a whole field that is longer than 255 characters, you must use this, even if the field itself is defined as longer than 255 characters.
    Example
    NEW-PAGE LINE-SIZE 1000.
    DATA: F1(500) VALUE 'F1'.
    WRITE: /      F1 COLOR COL_NORMAL.  " Output with length 255
    WRITE: /(500) F1 COLOR COL_NORMAL.  " Output with length 500
    Awrd Points if useful
    Bhupal

  • How to open-up a pdf file to a particular page via java? (file and page number from another program)

    I have created an Access 2003 Form. Data is entered. The data can be viewed once entered in the same form format, with one addition. The addition is a link to another program where we store files. The files stored are pdf documents. Each document is a scanned file (500+ pages). The link can open-up the pdf file. I want the link to open-up the pdf file to a particular page. I will supply the page number from the database.
    I am aware of Adobe Acrobat 7.0 PDF Open Parameters using a URL that specifies the file to be opened plus actions to be performed once the file is openend (i.e. http://example.org/doc.pdf#page=3). However, the 3rd party program transfers a file from a server to the client via java. The file does not go via a web browser. The java code transfer the file directly from the file server to the the client.
    Any idea how to accomplish the task of viewing a particular page with the process flow described?
    I am using Adobe Acrobat 7.0 Professional.

    So you are reading this file in a standalone version of Acrobat? If so then use the PDF Open Parameters /a option via the command line.
    Sabian
    Example:
    C:\Program Files\Adobe\Acrobat 7.0\Acrobat>Acrobat.exe /A "zoom=1000=OpenActions" "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\SimpleSubmit.pdf"
    Where:
    Path to Acrobat: C:\Program Files\Adobe\Acrobat 7.0\Acrobat>Acrobat.exe
    Note: The example starts in the Acrobat application directory
    Switch: /A
    Parameter Syntax: "zoom=1000=OpenActions"
    Path to file: "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\SimpleSubmit.pdf"
    Note: The quotes are very important for the syntax to work appropriately.

  • Error accessing page in book through Web Standard

    I get the following error while I click on the Book name in web standard. I am a member of PAS with admin role.
    Error:
    Event Type: Error
    Event Source: ProClarity Server
    Event Category: None
    Event ID: 4
    Date:  8/29/2008
    Time:  9:49:07 AM
    User:  domain\user
    Computer: <XXXXX>
    Description:
    Error when accessing page "Detail Report" ({F695084C-9DEE-4862-8424-0847C037E3B2})
    from book "Cube Book" ({A1BEB439-F455-404F-A2D2-31B71FDE26D9})
    Cache File Name:  (unknown)
    Call Stack:
    Location: line #1195 of file PRepository.cpp
     - Error-code: (0x18), Error-number: 0x80070005
     - Error opening file for writing
    Location: line #448 of file PRepository.cpp
     - Error-code: (0x18), Error-number: 0x80070005
     - ResolveBookAndPage()

    Hi Joey,
    Here are the steps I followed and did iisrest generously,
    Removed Everyone from wwwroot/PAS and child nodes
    Tested and found the issue is back again
    MyComputer --> Manage --> Local Users and Groups --> Groups
    Created a group - PAS Users
    Added myself to the newly created PAS Users
    Added PAS Users to wwwroot/PAS and child nodes
    Tested and found the issue is not resolved
    If I try Everyone, then the issue is resolved
    Let me know if I am missing something.
    Thanks
    modaz

Maybe you are looking for

  • Day-Offs are considering as training days in Training and Event Management

    Hi One and All, I configured Time Schedules and assigend to Business Events, when I check the Time schedule in Business Events It is considering the Day_offs as a Training Days, But my requirement is Day-offs should not be Training days. For example:

  • Need help with a Asus 27" monitor with webcam problem.

    Need help with a Asus 27" monitor I bought.  Model VK278Q.  The issue is that the webcam will not work properly.  Various applications can see the webcam, but I just get a black box.  From what I have read, the issue seems to be that there are no off

  • RTMT ALARM CallProcessingNodeCpuPegging

    We are receiving an RTMT alert for one of the node in the cluster. Error is [RTMT-ALERT] CallProcessingNodeCpuPegging. Processor load over 90 Percent. hostagt (45 percent) uses most of the CPU lease suggest what to do for the resolution of this and a

  • Backup Schedule Strategy

    I am working in a company's plant and i have an external hard disk to take the backup . What strategy i should aquire for backups.

  • What's that "STAR"?

    Can somebody tell me what's that star which appeared after LOLLIPOP upgrade!! Thank you very much... Solved! Go to Solution.