Get location/coordinates for a field using JavaScript in Acrobat Professional

Good day,
I am looking for a way to get the coordinates of a text field.
I would like to create a listbox and set the location of the listbox top left to the text fields bottom left coordinates, I have had a look at the scripting guides ... could not turn up anything.
I know how to create and populate this listbox using the JavaScript code, only problem is, to get the coordinates of the text box.

Try this:
1. Move or change the dimensions of the text boxes on the extracted page in the configuration that you want.
2. When you are satisfied with the new configuration, modify the following JavaScript to use the names of the text boxes that you want to include on the page.
//find_rect //find coordinates of text boxes whose names are included in the var rct,ary = ["fld_1","fld_2","fld_3","fld_4"]; //...etc.
for (j = 0; j<ary.length; j++){
console.println(ary[j]);
rct = this.getField(ary[j]).rect;
for (i= 0; i< rct.length; i++) console.println(rct[i]);
3. Add the modified code to the document level of form. (as a doc level javascript but with no function name or brackets included.
4. When you run the code, the coordinates for the fields that you have included in the array will be printed in the console window:
Example:
fld_1
21
777
296
717
fld_2
30
769
65
729

Similar Messages

  • Select only one type of field using JavaScript in Acrobat X

    Looking for a way to select all fields of the same type on a form at once?
    Such as selecting all text fields to modify the font type, or all buttons to modify display values. Prior versions 6,7, & 8 were able to do this. Would prefer a script for each control type however I do not see any information in the JavaScript Reference Guide about this.

    The is no UI for selecting field by type in the newer versions of Acrobat.
    Have you looked at the numFields property and example?
    With some modification:
    function FindFieldType(cType)
    var aFieldNames = new Array(); // array of fields of type sFieldType
    // walk the array of field names;
    for ( var i = 0; i < this.numFields; i++) {
      var fname = this.getNthFieldName(i); 
      if ( fname.type = cType ) {
      // match to field type - add to array of names;
      aFieldNames[aFieldNames.length] = fname;
      } // end walk array of field names
    return aFieldNames;
    } // end FindFieldType function
    var aMyFields = new Array();
    // find button field type
    aMyFields = FindFieldType("button");
    // now do something with the array of field names;
    app.alert("button fields: \n" +  aMyFields.join("\n");

  • Adding current date to text field w/ Javascript in Acrobat 8

    I am trying to add the current date to a text field using javascript in Acrobat 8 Professional. I am using the util.printd function in a javascript function but the date of creation shows in the text field, NOT today's date. Any clues??
    var f = this.getField("myField");
    if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());

    Thanks. I've used it also without the empty value check and had the same result of showing the creation date and not the current date.

  • How do i get a colormap for intens graph using basic imaq

    This is a follow up to
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000B58D0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_TIER_0=0&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=how+do+i+get+a+colormap+for+intens+graph+using+basic+imaq&USEARCHCONTEXT_QUESTION_S=0
    where I asked for help getting a colormap for saving an image as a jpeg. Now, I have decided that I would like to use an intensity graph for my display of the RGB image that I have captured using my pci-1411 frame grabber board. How do I get the right colormap for the intensity graph display? I do not have vision and do not intend to purchase it. I am using the basic IMAQ package.
    jc
    Mac 10.4
    LV7.1
    CLD

    Dear Sir, usually the intensity graph will help you with monochrome images, since they have a one color intensity. If you want more colors you will be able to get up to 256, and not true color (24 bit). You might want to use the Picture Control instead or a Child Window approach, please look in your Help menu, 'Search IMAQ Examples...' and then browse for IMAQ examples and choose the ones that are for Picture Control. For the Child Window look in our website for an example called 'IMAQ Display Without IMAQ Vision'.
    Good luck!
    Nestor.
    Nestor
    National Instruments

  • How reset Acrobat form field using javascript API

    How reset Acrobat form field using javascript API

    There are several ways:
    resetForm(["Text1"]);
    or
    getField("Text1").value = getField("Text1").defaultValue;
    George

  • I want to get desktop path for client user using webutil

    oracle database 11g
    oracle forms 10 g
    client windows
    i want to get desktop path for client user using webutil
    as i want to save file in this path

    To get the user's path to their Desktop is a two step process.  First, you have to echo the %USERPROFILE% to a output file and secondly, read the directory from the output file in to Forms.  The code would look similar to the following:
    /* When-Button-Pressed trigger */
    DECLARE
      v_temp_path VARCHAR2(250);
      v_temp_file VARCHAR2(12) := 'webutil.log';
      f_file Client_Text_IO.File_Type;
    BEGIN
      Client_Host('cmd /c echo %USERPROFILE%\Desktop > c:\'||v_temp_file);
      f_file := Client_Text_Io.FOpen('c:\'||v_temp_file, 'R');
    Client_Text_Io.Get_Line(f_file,v_temp_path);
    Client_Text_Io.FClose(f_file);
       b_dummy := WebUtil_File.Delete_File('C:\'||v_temp_file);
      --At this point, you have the path stored in the v_temp_path variable.
      --You can assign this variable to a block item or reference it directly in your code.
    END;
    When you reference the value of the v_temp_path, don't forget to wrap the value in double-quotes (" ") becuase the path will have spaces.  Since your plan is to write a file to the user's desktop, your call to FOPEN will look  like this:
    f_file := Client_Text_Io.FOpen('"'||v_temp_file||'"','W');
    Hope this helps,
    Craig...

  • Import an xml file into adobe designer field using javascript

    Adobe javascript experts ,please help me.
    I need to load the data from an xml file into a text field in designer
    using javascript and then go through each node in the loaded xml and compare that with form fields in designer and if matching fill the value(node's value from the loaded xml) in form fields.
    Please give ur suggestions.
    Thanks in advance!!!
    regards,
    sowmya

    Thanks for the fast response.
    I saw your example and specifically the javascript code
    xfa.host.importData("filename.xml").
    Just by giving this alone how do I access the values in the xml???
    Just by giving the above javascript, my value is not getting populated when I see in pdf preview.
    But apart from that you have done dataconnection also and binding in all the columns.What is this for??
    Could you kindly explain what u r doing step by step??
    Thanks again.
    regards,
    Sowmya

  • 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 error in Mozilla, reading xml using JavaScript

    Hi All,
    I am working with javascript with xml, getting error in Mozilla
    1. see html and xml file and check xml file path before test ---
    2. please, go through the html and xml file.
    read_xml.html
    =================
    <html>
    <head>
    <title>xml file using javascript</title>
    <script type="text/javascript">
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    //loading xml file
    function doLoadXML(xmlFile)
    xmlDoc.async="false";
    xmlDoc.onreadystatechange=doStateVerify;
    xmlDoc.load(xmlFile);
    rootData=xmlDoc.documentElement;
    function doStateVerify()
    if (xmlDoc.readyState != 4)
    return false;
    // reading xml file
    function doReadXML()
    alert("calling function");
    doLoadXML("C:/Documents and Settings/webdeveloper06/Desktop/for_test/comp-info.xml");
    alert("loading file...........");
    var dataArr=new Array();
    dataArr=xmlDoc.getElementsByTagName("comp-info");
    for(var m=0; m <= dataArr.length-1; m++)
              alert("entering inside looping here");
              document.write("<Table border='1px'><tr><td>");     
              document.write(dataArr[m].getElementsByTagName("name")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("description")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("web-addr")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("address")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("city")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("postal-code")[0].firstChild.nodeValue);
              document.write(dataArr[m].getElementsByTagName("country")[0].firstChild.nodeValue);
              document.write("</input></td></tr></table>");
    </script>
    </head>
    <body>
    <input type="button" value="Display XML Data" onClick="doReadXML()" />
    </body>
    </html>
    com-info.xml
    =========
    <?xml version="1.0" encoding="iso-8859-1"?>
    <itcopany>
    <comp-info>
    <name>xxx</name>
    <description>IT Reaserch Company</description>
    <web-addr>http://xxx.com</web-addr>
    <address>mehdipatnam</address>
    <city>Hyderabad</city>
    <postal-code>777888888</postal-code>
    <country>IN</country>
    </comp-info>
    <comp-info>
    <name>yyyyy </name>
    <description>Non IT Company</description>
    <web-addr>http://yyyy.com</web-addr>
    <address>xyxxyxyx</address>
    <city>Banglore</city>
    <postal-code>78878787878</postal-code>
    <country>IN</country>
    </comp-info>
    <comp-info>
    <name>zzzzzzz</name>
    <description>IT Company</description>
    <web-addr>http://zzzzzzz.com</web-addr>
    <address>secondrabad</address>
    <city>Hyderabad</city>
    <postal-code>9999999999999</postal-code>
    <country>IN</country>
    </comp-info>
    </itcopany>
    output status
    ============
    1. getting output in IE
    2. not getting output in Mozilla
    Can anyone Helpout, To get data in Mozilla
    regards,
    Abu

    Try to check this document Browser Support for SAP and use PAM (Product Availability Matrix) to check for the compatibility of your SAP system with the browser.
    If you are only the user of the Web Dynpro you would have probably no other choice than change the browser.

  • Read versions of comments field using javascript client object model

    Hi,
     Does someone knows how to Read versions  of comments field in 'tasks' list using javascript client object model?
    Thanks
    Manvir

    Hi,
    According to your description, I know you want to read versions of comments field.
    We can use the
    SPServices to achieve it. The below code for your reference:
    $().SPServices({
    operation: "GetVersionCollection",
    async: false,
    strlistID: "tester",
    strlistItemID: 1,
    strFieldName: "comments",
    completefunc: function (xData, Status) {
    $(xData.responseText).find("Version").each(function(i) {
    console.log("Name: " + $(this).attr("Information") + " Modified: " + $(this).attr("Modified"));
    More information:
    http://spservices.codeplex.com/releases/view/81401
    Best Regards,
    Dennis Guo

  • How to get change log for z-fields in VBAk(Sales order)

    Hi All,
    Please help me in this.
    My requirement is get the change log for z-fields in sales order.
    In the sales order header level we have one tab Additioanl data.
    In this we have z-fields, if we change any of the field value, it is accepting the same and updating in data base as well.
    But it is not appearing in change log<. I.e. Environment->changes.
    How to get the change log for the z-fields.
    In data element level enable the check box of change document.
    Please help me in this.
    Thanks in advance
    Jaya,G

    Hi Jaya,
    For this you need to do some coding. Here is a link which tells you, step by step procedure how to activate Change log for the Z tables.
    THe Object that you need to use for Sales Document   is VERKBELEG
    [https://wiki.sdn.sap.com/wiki/display/ABAP/Maintaining%20Change%20Log%20for%20Database%20Tables]
    Hope this helps..
    This is Primarily a Technical Consultant Job. Take his help before you make any changes.
    Thnks
    Srini

  • Set annotation flags for link annotations using JavaScript

    The JavaScript for Acrobat API Reference doesn't list Link as an annotation type[1]even if it's a subtype in the PDF specification (8.4.5 Annotation Types).
    I know how to get the link objects using JavaScript, but they don't have a print property, because it belongs to its mother annotation object.
    Example:
    I have a scanned PDF, OCRed, with two links. Acrobat's content panels shows an annotation object with two links.
    >this.syncAnnotScan();
    >var annots = this.getAnnots();
    returns
    >null
    Any idea how to set the annotation flag to Print for a link annotation using JavaScript? (flag 3 aka Print is required for PDF/A)
    [1] http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.20.html

    Hi,
    Thanks for replying. But this example sets falshvars through the UI, and as I have mentioned I want this done from javascript in the document - I dont have the value for some of the flashvars during embedding.
    (Using a EI call is my last resort, as I am not expected to make any modification to the SWF file - the SWF file, hitherto, was being hosted in a HTML where it was being passed flashvar params)

  • Read-Only Text Field Using JavaScript Code

    I'd like to make a text field read-only by using JavaScript and also having IF & ELSE statements.
    I want it to be like this:
    if the answer from the dropdown menu is YES, then the text field is read only but if the answer is NO then the text field is fillable.
    Thanks in advance

    Use this code as the custom validation script of the drop-down in question:
    this.getField("Text1").readonly = (event.value=="Yes");

  • To get f4 help for salesperson field ,transaction me21n & me22n

    Hi Super-Techies,
    I am a new-bie in the world of enhancement.
    The reuirement here is I need to create a custom table with 1 field (prep_name). (This is done)
    Now the reuirement is that whenever user goes to transaction ME21N/ME22N, he wants me to add a f4 help for salesperson field (navigation : ME21N/ME22N -> CLICK ON COMMUNICATION TAB -> SALESPERSON). The f4 help should display the field from my custom table.
    As far as my knowledge is cond=cerned, I can use the function module 'F4IF_INT_TABLE_VALUE_REQUEST' to achieve this requirement.
    But the issue I am facing is where to write this logic and how to proceed. Can anyone help me in this case?
    Any help in this regard would be appreciated.
    Thanks & Regards,
    Vinit
    Edited by: vinit005 on Nov 1, 2010 12:43 PM

    Hi Vinit,
    I also had that requirement. There is no customer exit/BADI by which we can achieve that(as far as my knowledge), we have to use access key to achieve that. So we have gone for customer exit "MM06E005" to add Customer data tab in header and added our own fields, like Sales Person, Buyer Details etc.
    Thanks & Regards,
    Faheem.

  • How do I set (or auto populate) the value of a modal dialog field using javascript?

    I have a Modal Dialog on my SharePoint 2010 page the following fields: Your Name, Subject, Priority, Message. 
    It links to a list I have on the site. The second field, Subject, I want to auto populate it when the window opens, so the user can leave it as is or modify the subject. I want to set the field value using javascript. 
    I've tried setting the field with this code:
    document.getElementById('Subject').value = "Test";
    and also, this:
    setFieldValue('Subject','My custom value');
    Neither work. 
    How do I set the value of the subject field when the user first opens the dialog using javascript?
    Please help.

    I am sure, you are looking at default field value of a list column(single line) in a modal window, if so please try below code
    <script src="https://code.jquery.com/jquery-2.1.0.min.js" type="text/javascript" abp="397"></script><script type="text/javascript" abp="398">
    $(document).ready(function(){
    $('input[name*="Subject"]').val("Test");
    </script>​​​​​​
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

Maybe you are looking for