Home | History | Annotate | Download | only in javascript
      1 {{header}}
      2 {{object 1 0}} <<
      3   /Type /Catalog
      4   /Pages 2 0 R
      5   /AcroForm 4 0 R
      6   /OpenAction 10 0 R
      7 >>
      8 endobj
      9 {{object 2 0}} <<
     10   /Type /Pages
     11   /Count 1
     12   /Kids [
     13     3 0 R
     14   ]
     15 >>
     16 endobj
     17 % Page number 0.
     18 {{object 3 0}} <<
     19   /Type /Page
     20   /Parent 2 0 R
     21   /Resources <<
     22     /Font <</F1 15 0 R>>
     23   >>
     24   /Contents [21 0 R]
     25   /MediaBox [0 0 612 792]
     26 >>
     27 endobj
     28 % Forms
     29 {{object 4 0}} <<
     30   /Fields [5 0 R]
     31 >>
     32 endobj
     33 % Fields
     34 {{object 5 0}} <<
     35   /T (MyField)
     36   /Type /Annot
     37   /Subtype /Widget
     38   /Rect [100 100 400 400]
     39   /Kids [
     40     6 0 R
     41     7 0 R
     42     8 0 R
     43     9 0 R
     44   ]
     45 >>
     46 endobj
     47 {{object 6 0}} <<
     48   /FT /Tx
     49   /Parent 5 0 R
     50   /T (Sub_X)
     51   /Type /Annot
     52   /Subtype /Widget
     53   /Rect [200 200 220 220]
     54 >>
     55 endobj
     56 {{object 7 0}} <<
     57   /FT /Tx
     58   /Parent 5 0 R
     59   /T (Sub_A)
     60   /Type /Annot
     61   /Subtype /Widget
     62   /Rect [220 220 240 240]
     63 >>
     64 endobj
     65 {{object 8 0}} <<
     66   /FT /Tx
     67   /Parent 5 0 R
     68   /T (Sub_Z)
     69   /Type /Annot
     70   /Subtype /Widget
     71   /Rect [240 240 260 260]
     72 >>
     73 endobj
     74 {{object 9 0}} <<
     75   /FT /Tx
     76   /Parent 5 0 R
     77   /T (Sub_B)
     78   /Type /Annot
     79   /Subtype /Widget
     80   /Rect [260 260 280 280]
     81 >>
     82 endobj
     83 % OpenAction action
     84 {{object 10 0}} <<
     85   /Type /Action
     86   /S /JavaScript
     87   /JS 11 0 R
     88 >>
     89 endobj
     90 % JS program to exexute
     91 {{object 11 0}} <<
     92 >>
     93 stream
     94 function TestGetField() {
     95   try {
     96     var field = this.getField("MyField");
     97     app.alert("field is " + field.name);
     98     var sub_a = this.getField("MyField.Sub_A");
     99     app.alert("sub_a is " + sub_a.name);
    100     var nonesuch = this.getField("MyField.nonesuch");
    101     app.alert("nonesuch is " + nonesuch);
    102   } catch (e) {
    103     app.alert("Unexpected error: " + e);
    104   }
    105 }
    106 function TestGetArray() {
    107   try {
    108     var subs = this.getField("MyField").getArray();
    109     app.alert("found " + subs.length + " sub-fields:");
    110     for (i = 0; i < subs.length; ++i) {
    111       app.alert(subs[i].name);
    112     }
    113   } catch (e) {
    114     app.alert("Unexpected error: " + e);
    115   }
    116 }
    117 TestGetField();
    118 TestGetArray();
    119 endstream
    120 endobj
    121 {{xref}}
    122 trailer <<
    123   /Root 1 0 R
    124 >>
    125 {{startxref}}
    126 %%EOF
    127