Professional Web Applications Themes

"Page" and "Rect" props of the Field prop in Javascript API - Adobe Acrobat SDK

Page property of the Field property in Javascript Acrobat API returns an array of pages that this field exists in. On the other hand, "rect" property returns just one set of coordinates of the field on a page. My questions are: 1. Suppose field's "page" property returns two pages, 2 and 3, for a doent in question. How I can use "rect" property of a field to determine position of the field on these pages? 2. If "rect" property of a field is not the one to be used to determine position of a field on a page - then ...

  1. #1

    Default "Page" and "Rect" props of the Field prop in Javascript API

    Page property of the Field property in Javascript Acrobat API returns an array of pages that this field exists in. On the other hand, "rect" property returns just one set of coordinates of the field on a page.

    My questions are:
    1. Suppose field's "page" property returns two pages, 2 and 3, for a doent in question. How I can use "rect" property of a field to determine position of the field on these pages?
    2. If "rect" property of a field is not the one to be used to determine position of a field on a page - then what property should I use?
    ArtIn_Act@adobeforums.com Guest

  2. #2

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    When you have fields with the same name like "Text" you can access the different fields:

    this.getField("Text.0")

    this.getField("Text.1")

    ....

    Look at the doentation of the field object.
    Bernd Alheit Guest

  3. #3

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    Bernd,

    Thank you for the quick reply. I read the "field" doentation, but did not find any reference to page number being used in the construction of field name hierarchy. Following is my explanation of how I understood your example:

    Suppose the field in question has name "Text". Its "page" property returns an array of three pages - 4, 6 and 8. Then, in order to get coordinates of this field "Text" on these separate pages, I have to construct the fully qualified name as "Text.0" (corresponds to page #4 in my example), "Text.1" (page 6) and "Text.2" (page 8) ? Or it should be directly "Text.4", "Text.6", "Text.8"?

    I appreciate your help in this issue.
    ArtIn_Act@adobeforums.com Guest

  4. #4

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    The fields are identified by an index (0-based), not page number. The index is determined by the order in which the individual widgets of this field were created. In your example the field "Text.0" can be on page 4, 6, or 8.
    Bernd Alheit Guest

  5. #5

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    Ok. I am getting more and more lost :). My understanding is that "widget" may be a part of the "field" and in the simplest case widget IS the field. Let "Text" in your example be a simple field (no widgets as part of the field). Using your example: field "Text" is on page 4, 6 or 8.(call to getField("Text").page returns array 4,6,8). What is the api call to coordinates of "Text" field on page 6?
    ArtIn_Act@adobeforums.com Guest

  6. #6

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    Because there is no way to directly relate the array position of the field with what page it is on, you would need to iterate through the multiple "Text" fields, using the method Bernd showed, and find the one that has the page property you are looking for.

    var myRect = null;
    for ( var i = 0; i < 3; i++ ) { if ( this.getField("Text." + i).page == myPage ) { myRect = this.getField("Text." + i).rect; break; } }
    PDL@adobeforums.com Guest

  7. #7

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    Aha! Thank you, guys! So, to summarize, at least in the case of "simple" field, the notation FieldName.PageIndex creates a fully qualified name for a field located on a specific page. Page index is an 0-base index to an array of pages that is returned for a generic FieldName.

    Example:

    Call getField("Test").page returns (4, 6, 8 ). It means that there are three fields in the doent that start with "Test": "Test.0", "Test.1" and "Test.2" and these fields are located on pages 4, 6 or 8 but not necessarily in order.

    Calls to getField("Test.0").page, or getField("Test.1").page or getField("Test.2").page
    should _always_ return one page where this field is located and not an array of pages.

    Correct?
    ArtIn_Act@adobeforums.com Guest

  8. #8

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API



    Correct?




    Yes
    Bernd Alheit Guest

  9. #9

    Default Re: "Page" and "Rect" props of the Field prop in Javascript API

    Bernd - thank you for your help!
    ArtIn_Act@adobeforums.com Guest

Similar Threads

  1. Replies: 0
    Last Post: August 26th, 06:01 AM
  2. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  3. Replies: 2
    Last Post: September 15th, 04:35 AM
  4. dr("field").toString returns "400.0000" instead of "400"
    By Dan C Douglas in forum ASP.NET General
    Replies: 5
    Last Post: July 22nd, 05:48 PM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139