[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

Similar Messages

  • Get page number

    is there any way to get page number which my query search found it ?
    i mean when my search in documents such as word, pdf or ...

    If understand your requirement - that you want the page number of a document on which your search term was found - this is not possible. Oracle Text only keeps track of word offsets - for example it might know that "dog" is the 200th word in the document - it does not know about page numbers.
    The $I trace in ctx_output has no relevance to this problem.

  • When converting word to pdf the cover page of my documet gets page number 1.On the original the numb

    When converting word to pdf the cover page of my documet gets page number 1.On the original the number pages start from the second page.How to keep the original format?

    Michael's reponse is correct. However, as far as I knew, OFFICE 2007 came with printer metrics turned off, meaning it is not supposed to be sensitive to the printer selection. The setting is buried in the options list for compatibility. If it is turned off and a change in printer does affect the result, it would appear just one more of the many things in OFFICE 2007 that MS messed up. The latest one for me has been helping students with the messed up equation editor when you want to add equation numbers in a "standard" way. One of the MS employees even wrote a workaround macro for that problem.

  • CS6 - how to get page number?

    i have selected frame. I want to know page number, where it is.
    aSel = app.selection[0];
    alert (aSel.parent.name); - i get empty string
    cause it' Object spread. And what to do then? (without losing of right/left reffering)
    thanks
    p.s. in CS3 i did it, and in CS6 i get stuck.

    @Dmitry – for further reference see also:
    http://www.indiscripts.com/post/2012/06/so-what-s-new-in-indesign-cs6-scripting-dom
    http://www.indiscripts.com/post/2011/04/so-what-s-new-in-indesign-cs5-5-scripting-dom
    http://www.indiscripts.com/post/2010/10/so-what-s-new-in-indesign-cs5-scripting-dom
    For the whole documentation of the DOM:
    http://www.jongware.com/idjshelp.html
    Hm. While we are at it:
    Is there a "What's new in InDesign CS4 scripting DOM" somewhere?
    Just to complete the picture…
    Uwe

  • How to get page number from the PDF using Javascript

    Hi,
    We are having list of Single page PDF. The pdf are named in the order,
    ISBN_Author_01.PDF  (with real page number as i)
    ISBN_Author_02.PDF  (with real page number as ii)
    ISBN_Author_03.PDF  (with real page number as iii)
    ISBN_Author_04.PDF  (with real page number as 1)
    ISBN_Author_05.PDF  (with real page number as 2)
    ISBN_Author_06.PDF  (with real page number as 3)
    ISBN_Author_nn.PDF  (with real page number as 500)
    Here each pdf has a page number and in sequential order.
    The task is to check whether all the pdfs are in sequential order (i.e i, ii, iii, 1, 2, 3). If any page is missing, the script should throw an error report.
    To do this task, I am writing a Javascript to get the real page number from the PDF.
    Can anybody help me how to get the page number from the PDF using Javascript.
    Thanks,
    Gopal

    The "real" page number within a PDF is the count of the physical page starting at 0, zero.
    pageNum numPages
    The number printed on each page is the page label.
    setPageLabels  getPageLabel
    You will have to open each PDF and your script would need to know the page label for that file. I would expect you would need to build a 2 dimensional  array of the file names and the page label for the page within that array.

  • Getting page number while JSP printing- link rel="alternate" media="print"

    <link rel="alternate" media="print" href="reportprint.jsp"
    This i am using for printing report.jsp. report.jsp contains more than 2000 records. I need to have the page number to put the column header in each page.
    What is the possible way to get the page number in reportprint.jsp??

    Hi Raghuveer,
    I am getting the same error...
    were you able to resolve it??
    Part of log file says...
    [Jun 28, 2010 12:47:28 PM BST]:1277725648271:Thread[outboundThreadGroup3,5,outboundThreadGroup]:0:-1:stevux1213:10.145.81.43:-1:-1:STATEMENT:[fnd.wf.mailer.URLMIMETagListener]:oracle.apps.fnd.wf.mailer.URLMIMETagListener.tagFound(HTMLTagEvent) TAG {<META name="fwk-error" content="Error occured while processing the request">}
    [Jun 28, 2010 12:47:28 PM BST]:1277725648272:Thread[outboundThreadGroup3,5,outboundThreadGroup]:0:-1:stevux1213:10.145.81.43:-1:-1:STATEMENT:[fnd.wf.mailer.URLMIMETagListener]:fwk-error detected
    All,
    can you please help?
    Thanks,
    S

  • Getting Page number for Notes

    Hi
    I am using the below methods to retreive page number of notes.
    Method 1
    var myNotes = myDocument.stories.item(k).notes.everyItem().getElements();
    Method 2
    myDocument.stories.item(k).paragraphs.item(i).notes.length;
    Wat is the best way to scan through the notes in a document. I am trying to get the page number for each note(Page on which the note is placed)
    For Method 1:
    var myFrame = myDocument.stories.item(k).textContainers[0];
    var myPage=myFrame.parent.name;
    For Method 2:
    myDocument.stories.item(k).paragraphs.item(i).parentTextFrames[0].parent.name;
    In both the cases some of the page numbers aren't displayed. Can somebody tell me is there any other way or am i doing something wrong.
    Thanks

    Footnotes have a property storyOffset, which is the location of the footnote's cue in the text. This is an insertion point, so the following line gives myFootnote's page number:
    >myFootnote.storyOffset.parentTextFrames[0].parent.name
    Peter

  • Get page number from adobe reader activex control

    I used adobe reader activex contol in my application, I wanna access currect page number of open pdf, for that I require AcroExch.App.Avpageview. where we can get it and what would be the cost of it.Or any othe solution for access the page number of pdf.

    This is an interface supplied by Adobe Acrobat, Standard or Professional. (Note that EACH user will need to buy a copy). (And note that you cannot mix interfaces, so you won't be able to use this while displaying in the control).

  • Getting page number

    Hi, I have a label in my report which is a placeholder column. Is there a way which I can find out which page number that label will print on?
    Report Builder 10.1.2.3.0
    many thanks

    Like InoL said, srw.get_page_num will tell a formula what page number. If you want your field to display the page number on the report output, set the field source to "Page Number".
    function F_SignatureFormatTrigger return boolean is
    /* Using the "Print object on" property did not control the
       signature line because it's in the margin.*/
    v_page_num          number;
    begin
         srw.get_page_num (v_page_num);
         if     v_page_num = 1
         then     return (TRUE);
         else     return (FALSE);
         end if;
    end;

  • To get page number reset at instance

    Hello everyone!
    When i having tons of Sale order to print at one time(i am feeding the start NO/end NO to report), i want the page number to be reset at every instance of Sale order but not reset at the whole report as now.
    There is a repeat frame with the source of Sale order query and my page number columns in put in this frame.
    How to do this? Thanks a lot!

    You create a field (in the margin) with source Page Number. On the Page Numbering property, you set the 'Reset at' property to the order repeating frame.

  • How to get the page number that which have page item?

    i used Ilayouttarget .By using the selection target to get page number that which page have item to be.

    i used Ilayouttarget .By using the selection target to get page number that which page have item to be.

  • Anyone know to get pdf page number with PDFBOX?

    I have get page number but the page number display as code like this
    org.pdfbox.pdmodel.PDPage@113beb5how can convert "PDPage@113beb5" to the page number

    the pdf file at least must have 1 bookmark
    this is my code
    import org.pdfbox.pdmodel.PDDocument;
    import org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline;
    import org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem;
    import org.pdfbox.pdmodel.PDPage;
    import java.awt.image.*;
    import java.io.IOException;
    import javax.swing.*;
    * @author Amir
    public class pdfbookmark2 extends JFrame{
      public pdfbookmark2() throws IOException{
        mypanel p = new mypanel();
      public void pl(String s){
        System.out.println(s);
      public static void main(String[] args) throws IOException {
        new pdfbookmark2() ;
      class mypanel extends JPanel{
      PDDocumentOutline root;
      PDPage pdpage;
        public mypanel() throws IOException{
          PDDocument doca;
          doca =  PDDocument.load("C:/JavaGD.pdf");  // the pdf file must at least 1 bookmark
           root = doca.getDocumentCatalog().getDocumentOutline();
           PDOutlineItem item = root.getFirstChild();
              PDOutlineItem child = item.getFirstChild();
                  pdpage = item.findDestinationPage(doca);
           pl("string page ="+ pdpage.toString());
           doca.close();
    }

  • Displaying Page number in all pages of sap script output

    Hi All,
    I have a issues in displaying page number in all pages of sap script output.
    I have created a seperate window just above main window to display page number.
    I have given &PAGE& in the layout editor.
    Now in the sap script output i am getting page number as 1 in all the pages page number is not changing for pages-2,3, etc..
    Can anybody tell me the reason for the same!
    In some other objects same syntax is working fine. For this object it is not working!
    Is there any setting changes!
    Thanks i
    Thanks,
    Deep.

    Hi,
    Just check the Page Counter of the Next or Second Page which you defined.
    First page
    Mode                     START
    Numbering Type           ARABIC
    Second Page
    Mode                     INC
    Numbering Type           ARABIC
    Regards
    Bala Krishna
    Edited by: Bala Krishna on Oct 17, 2008 11:23 AM

  • Page number in body

    how to get page number in body of report

    There is solution for this. please refer to this thread
    http://social.msdn.microsoft.com/forums/en-US/tfsreporting/thread/b901c9b4-320e-4fbc-afa9-495d5566c168/
    With the Data or Layout tab view active select "Report" -> "Report Properties"
    On the "Report Properties" dialog select the "Code" tab
      In "Custom code:" add the new Functions to get the page numbers:
    Public Function PageNumber() as String
         Dim str as String
         str = Me.Report.Globals!PageNumber.ToString()
         Return str
    End Function
    Public Function TotalPages() as String
         Dim str as String
         str = Me.Report.Globals!TotalPages.ToString()
         Return str
    End Function
    Use it like:
    ="Page " + Code.PageNumber() + " of " + Code.TotalPages()
    Thanks Ayyappan Thangaraj, http://SQLServerRider.wordpress.com

  • 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

Maybe you are looking for