Add textFrame on each page of document

I've been trying to write a JavaScript script to add a textframe on each page of a document.
The script is wrote is:
var myDocument = app.activeDocument;
for (var pageCounter = 0; pageCounter < myDocument.pages.length; pageCounter ++) {
  //Create a text frame on page pageCounter
  var myTextFrame = myDocument.pages.item(pageCounter).textFrames.add();
  //Set the bounds of the text frame
  myTextFrame.geometricBounds = ["60p", "22p", "65p", "40p"];
  //Enter text in the text frame.
  var pageCounterPlus1 = pageCounter + 1;
  myTextFrame.contents = "Page " + pageCounterPlus1 + " of " + myDocument.pages.length}
In my 5 page document, the script is putting one textframe on page 1, 2 on page 2 and 2 and page 4, but omits pages 3 and 5.
My guess is that it's something about two-page spreads, but I don't know how to fix it.
Any suggestions?
Thanks.
Urban Landreman

Hi Urban,
Please add the following two lines after intialise the "myDocument"
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
myDocument.zeroPoint=[0,0];
Reason: May be your InDesign ruler and origin setting differ.
Regards,
Ramkumar

Similar Messages

  • How to add totals for each page in main window

    hi
      i have problem in scripts
      how to add total in first page ending and carry it to second page , at the end of second page again adding total and so on until last page.
    very urgent
    regards
    ratna

    Hi,
    Check these
    http://help.sap.com/saphelp_40b/helpdata/en/d1/8035c3454211d189710000e8322d00/content.htm
    http://membres.lycos.fr/jolyeric/SAP/Note_de_Cours_Ben/Sapscript/SAPscript_Control_Commands.doc
    try to use the command 'summing' along with one text symbol .Keep the if condtion when page changes at that time u dispay the total as ur keeping the total in text symbol it can be dispayed in the next page
    or this is round about way
    loop at <table>.
    call write_form.
    endloop.
    here u declare a variable 'c' and increment it by 1 in each loop. Then u chgeck if the program has started printing second page then u can print the number of records before printing the next page.
    eg :
    data : c type c value '0'.
    loop at <table>.
    c = c + 1.
    call write_form.
    endloop.
    in form:
    check when the next page is being printed, then u can print the number
    of lines 'c'.
    Feel free to revert back.
    --Ragu

  • How to add textframe with anchor to each para end

    I want to add textframe to each paragraphs end with anchor. Can anyone help on this?

    Hi N!mal,
    please try the below JS code.
    app.activeDocument.stories.everyItem().paragraphs.everyItem().insertionPoints[-1].textFrames.add()
    thx,
    csm_phil

  • Can I add Action button on each page of my pdf document

    I have created  many power point slides with an action button on each slide that allows the user to click to display a video clip.   I would like to create a pdf document of this and replace each of my action button in ppt with an action button that works in Acrobat.
    I noticed that action buttons can be added to forms, but I want to be able to add an Action Button on each of my ppt slides to start playing a video clip (each slide will have a different video).
    I would like to do this using any coding method (i.e. Javascript, VBA, C , etc).   I think acrobat uses Javascript.
    The reason, is that I want to display my power point slides on an IPad and they don't support hyperlink in power point.   I believe IPad does suppport the full acrobat capabilities.
    Can this be done ??  
    Any suggestions where to start ??
    Thank You,
    G

    NO problem creating the buttons and then playing this back in Acrobat. Works great.
    However, unfortunately, none of the PDF viewers for the iPad support playing movies.   So playing it there won't work :(.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Sat, 28 Jan 2012 11:00:47 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Can I add Action button on each page of my pdf document
    Can I add Action button on each page of my pdf document
    created by gw70115<http://forums.adobe.com/people/gw70115> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4171109#4171109

  • How to add an order number to each page of an adobe doc?

    I have a customer that is requiring us to add their order number to every page of multipage documents we send them.  Right now we're using typewriter and pasting the order number to each page individually.  Is there an easy way to automate this process?  So that for each order number, we just type in the order number once and each page subsequently has the order number stamped on it.
    Thanks in advance for any and all help.
    We are running both Adobe Acrobat 7.0 and 8.0.

    Perfect.  That's exactly what I was looking for.
    Thanks a lot.

  • Links in each page of a large document

    I have a 350+ pages PDF document and would like to add a link to the TOC in each page. Obviously not one by one because this would take a lot of work/time.
    I thought to use a general header or footer with the linked text. But I don't know how to put linked text in a header/footer. Can this be done?
    Is there any other way you know to easily add a link to all pages of a large document?

    Another way is to put your link in a button: buttons can be duplicated to all (or a range) of pages. If you don't like a button that 'looks like a button' just use 'no border, no fill', or even an icon to customise it.

  • Is there a way to sort a large document by a date on each page?

    We receive medical records, which are then scanned and saved as a single document. They are not provided to us in any type of order. I need to sort the document chronologically based on the date of treatment. And sometimes, a treatment records is more than 1 page.
    Is there a way to add a tag of some type to each page and then go through and have the entire document sort by the tag?  We review each page electronically, so adding a tag or highlighting the date of treatment is possible. Dragging and sorting each page, however is too burdensome when its close to 500 pages.
    I use Adobe Acrobat 9 Pro.
    Thank you in advance!!

    Thanks for the response Camino fan.
    Unfortunately setting these preferences in the finder haven't carried over into stacks on the dock. My finder organizes by kind as you described, but even after doing so, the stacks continue to sort by the default (name).
    Any other ideas?

  • Different headers on each page of a Pages document

    I searched for this, but every answer seemed to be some variation on "there's no reason to put a different heading on each page of a document". I do require this function, though, and was wondering if there's any way to do it.
    Thanks in advance for the help.

    I found on my computer, if you click on the header you can change it on each page.  There is also a place in Set Up under Sections at the bottom of the page that has a drop down to create a new Section either 'Starting with this section' or 'After this section'.  Hope this helps.  Also at the top there is a place under Headers & Footers to  choose either 'hide on first page of section' or 'match previous section'.  I believe if you deselect the 'match previous section' you can easily change the header or footer for each page.

  • How do make a watermark appear on each page in a word processing document?

    I got a watermark to show up on my first page that says in a big font, "Draft copy". How do I go about having this appear on every page? I'm using the word processing mode of Pages.
    Thank you.

    PS,
    Select your watermark and Format > Advanced > Move Object to Section Master.
    If your document already has more than one Sections, you will have to Copy this object and paste it into each Section. Being a "Section Master" mean that it will appear on each page of the section you insert it into.
    Jerry

  • How do I add a background color to a document in Pages?

    How do I add a background color to a document in Pages?  I have made an invitation, with a photo in it, the text is in color, and I want to make the background pink instead of white.  thanks

    whoops sorry figured it out thanks!

  • How do I extract each page from a long document and email to separate adresses?

    So here's my current situation. I have about a 200 page long PDF document. Each page has an individual customer number on it. Currently, I print out the 200 pg doc and email each one separately to the corresponding customer in numerical order.
    First of all, is there a way that I can extract the 200 pg document into 200 individual documents with one page each? Second, is there an efficient way to mass email the 200 customers with their corresponding document only, without seeing the other 199 documents?

    Splitting document - Acrobat Pro.
    An experienced programmer could write JavaScript to pick up the customer numbers and do something with it, but it's not for the faint hearted.

  • How to add an image or static text in the header of EACH page of a cross-Tab report

    Post Author: rtutus
    CA Forum: General
    Hi, I use Crustal 11.0.
    I have a cross Tab. I display the items on the left column and the months horizontally, the items are grouped by category field. The values are the sum of quantities are displayed for each month. Like this:
                             Items         Jan       Feb       March .....................Total
    Category 1                       
                             Item11         val11     Val12      Val13                     Total values
                             Item12         val21     Val22      Val23                     Total values
                             Item13         val31     Val32      Val33                     Total values
    Category 2                       
                             Item21         val11     Val12      Val13                     Total values
                             Item22         val21     Val22      Val23                     Total values
                             Item23         val31     Val32      Val33                     Total values
    Category 3                       
                             Item31         val11     Val12      Val13                     Total values
                             Item32         val21     Val22      Val23                     Total values
                             Item33         val31     Val32      Val33                     Total values
    The problem, I want to add a page header for each page of the report.
    When Crystal reports first displays my cross-tab in the designer, CR displays the cross tab in the Report header section. I d like to add text or image for each page and not only at the begining of my Cross-Tab.
    If I just add an image or text at the top of the report designer, which is my report header, I get the image or text only on the begining of the 1st page of my report but never in the other following pages.
    If I try to work around the problem and move the cross Tab to a group section instead, and then put the Image in the group header, I get what I want, but the problem is that:
    The columns header: Jan, February....December are displayed for each group of my report and not only in the beginning of the report. I get something like this:
                             Items         Jan       Feb       March .....................Total
    Category 1                       
                             Item11         val11     Val12      Val13                     Total values
                             Item12         val21     Val22      Val23                     Total values
                             Item13         val31     Val32      Val33                     Total values
                             Items         Jan       Feb       March .....................Total
    Category 2                       
                             Item21         val11     Val12      Val13                     Total values
                             Item22         val21     Val22      Val23                     Total values
                             Item23         val31     Val32      Val33                     Total values
                             Items         Jan       Feb       March .....................Total
    Category 3                       
                             Item31         val11     Val12      Val13                     Total values
                             Item32         val21     Val22      Val23                     Total values
                             Item33         val31     Val32      Val33                     Total values
    You see the months get duplicated. Any way, my real need is to add an image or text in the header of EACH page of a cross-Tab report.
    Thanks a lot for your help.

    Hi Divya,
    you could do for example in the wdDoInit() of the view
    wdContext.currentContextElement().setPicture("picture.gif");
    Now you assign this context variable to the Tab using the Tab_header's imageSource-Property. When you click on its value column, you see a button with three dots on it. If you click on this button, you will get all context nodes and attributes for this View. Usable variables are clearly marked, you now choose the one named Picture or what ever name you prefer to use. But it must correspond to the one set in the wdDoInit.
    I think setting a picture (not necessarily for the tab-page) is done in one of the excellent tutorials. If you are a newcomer I strongly recommend doing some of the tutorials.  I have learned tremendously from them.
    Hope this helped
    Harald

  • How do I colour the background on my form and add a header to each page

    I have created a 4 page form.  HI want to have each page a light cream but can not finure out how to add colour and I want the header to show on each page.  Any ideas?

    Hi DouglasReid,
    Please try the steps mentioned below to add color and headed and footer.
    Once you are in the design view,
    1) Click on the Option >Click to Add Header to add Header.
    2) Click on forms setup to change to color of the form.
    Thanks,
    Vikrantt Singh

  • Save each page of a multi-page document as a separate file using spawned file names with javascript

    Hello
    We are currently changing our hard-copy personnel files and converting them to pdf files.  We have scanned the entire file into one multi-page document.
    I am wanting to save each page (or groups of pages) as separate files.
    In order to facilitate this, I have duplicated field names--such as FirstName, LastName, EmpNo on each page.  This information should be static for the entire file.
    However--I also need information that will change for each individual "page" or document--such as TypeOfDoc, Date, etc.  I have used the Spawn fields using the overlay method on each of the pages in the document.  Then I went in and filled in the information for each page of the document--such as TypeOfDoc, DateOfDoc.
    Now I want to save each page of the document as a separate file using the field names as the file name.
    I first created an action that would split all the pages into separate files and save them into a folder.
    Then I want to save each file as a specific file name based on the information in the fields.
    My problem is obtaining the name of the spawned field name.  The rest of the field names I am not having a problem with.
    This is what I have so far to name the file.
    // Get the field value
    var oPage = this.pageNum;
    var fn = getField("P" + oPage + ".TEMPLATE.DateOfDoc").valueAsString + getField("FirstName").valueAsString + "-" + getField("LastName").valueAsString;
    // Specify the folder
    var fldr = "/n/Personnel/ScannedDocuments/NAMEDPAAS/";
    // Determine the full path
    var fp = fldr + fn +".pdf";
    // Save the file
    myTrustedSpecialTaskFunc(this, fp);
    This code is also accompanied with folder level scripts.
    My problem is obtaining the name of the spawned fields using javascript.  Each document has several pages--so I would like to obtain the field name through script.
    I receive the following error.
    TypeError: getField("P" + oPage + ".TEMPLATE.DATE") is null
    I think this is due to the fact that I have extracted all the pages as individual files.
    If I were to do the above, but not extract the pages first--I do not know how to just save one page at a time.
    Please help.  This is a massive project, and if we have to save each file individually, it will take a lot of time.
    I am a beginner, so any assistance is appreciated.
    Thank you

    I am not understanding exactly where to put the curly brackets.  I have tried two different ways, and still get the same error.
    This is one way
    var oPage = this.pageNum;
    // Specify the folder
    var fldr = "/n/Personnel/ScannedDocuments/NAMEDPAAS/";
    // Determine the full path
    var fp = fldr + fn +".pdf";
    for (var i = 0; i < this.numPages; i++) 
    var fn = getField("P" + oPage + ".template.DateOfDoc").valueAsString + getField("FirstName").valueAsString + "-" + getField("LastName").valueAsString;
    {this.extractPages({  
    nStart: i,  
    cPath : fldr + fn + ".pdf"
    The other is this
    var oPage = this.pageNum;
    // Specify the folder
    var fldr = "/n/Personnel/ScannedDocuments/NAMEDPAAS/";
    // Determine the full path
    var fp = fldr + fn +".pdf";
    for (var i = 0; i < this.numPages; i++) 
    var fn = getField("P" + oPage + ".template.DateOfDoc").valueAsString + getField("FirstName").valueAsString + "-" + getField("LastName").valueAsString;
    this.extractPages({  
    nStart: i,  
    cPath : fldr + fn + ".pdf"
    Thank you for your help.

  • I am creating an I-Web webpage.  When I add pages, the only way to navigate throught the pages is with the menu bar on the left.  How do I navigate to each page on the actual website?

    I am creating a website using i-web.  When I add pages, they appear at the top of the webpage, but I cannot navigate to each page in the navigation bar.  I can only navigate in the menu bar located on the left side of the program.
    How do I navigate thru the website?

    You don't unfortunately, iWeb though great does not allow that funtion.
    If it is a deal breaker for you I would suggest SandVox or RapidWeaver.
    I personal like SandVox
    How ever my website is WordPress, you have to understand a little code, but a lot more freedom
    LearnFromLee
    I may receive some form of compensation, financial or otherwise, from my recommendation or link. <Edited by Host>

Maybe you are looking for