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 % Forms
     28 {{object 4 0}} <<
     29   /Fields [5 0 R]
     30 >>
     31 % Field
     32 {{object 5 0}} <<
     33  /FT /Tx
     34  /T (MyField)
     35  /Type /Annot
     36  /Subtype /Widget
     37  /Rect [100 200 150 250]
     38 >>
     39 % OpenAction action
     40 {{object 10 0}} <<
     41   /Type /Action
     42   /S /JavaScript
     43   /JS 11 0 R
     44 >>
     45 endobj
     46 % JS program to exexute
     47 {{object 11 0}} <<
     48 >>
     49 stream
     50 function testField(x) {
     51   var field = this.getField("MyField");
     52   field.value = x;
     53   var y = field.value;
     54   app.alert("Answer for \"" + x + "\" is: " + typeof(y) + " " + y);
     55 }
     56 testField("");
     57 testField("goats");
     58 testField("b4");
     59 testField("b4.5");
     60 testField("4x");
     61 testField("4.5x");
     62 testField(4);
     63 testField("4");
     64 testField(" 4");
     65 testField("4 ");
     66 testField("                          4                                      ");
     67 testField("4 3 2 1");
     68 testField("-4");
     69 testField("23.00000001");
     70 testField("23.00000000000000001");
     71 testField(40000000000000000000000000);
     72 testField("40000000000000000000000000");
     73 testField("25,5");
     74 testField("1e+5");
     75 testField("1e5");
     76 testField("1e-5");
     77 testField("-1e-5");
     78 testField("1.2e5");
     79 testField(Infinity);
     80 testField("Infinity");
     81 testField("INFINITY");
     82 testField("INF");
     83 testField(NaN);
     84 testField("NaN");
     85 testField("NAN");
     86 testField("0x100");
     87 testField("0x100.1");
     88 testField("0x100,1");
     89 testField("0x100x1");
     90 testField("123x6");
     91 testField("123xy6");
     92 testField("123.y6");
     93 testField("1,000,000");
     94 testField("1.2.3");
     95 testField("1-3");
     96 testField("1+3");
     97 testField("1.-3");
     98 testField("1.+3");
     99 testField([1, 2, 3, 4]);
    100 testField("[1, 2, 3, 4]");
    101 testField({a: 1, b: 2});
    102 testField("{a: 1, b: 2}");
    103 testField(function(x) { return x+1; });
    104 testField("function(x) { return x+1; }");
    105 endstream
    106 endobj
    107 {{xref}}
    108 trailer <<
    109   /Root 1 0 R
    110 >>
    111 {{startxref}}
    112 %%EOF
    113