Tutorial: Using Checkboxes in 3D PDF Documents



Toggling the Display of Displacement Vectors

Checkboxes present yes-or-no choices for individual items. If the document contains multiple check boxes, the user can typically select as many or few of these as wanted.

Toggling the Display of Displacement Vectors

Embed 3D object into PDF document and click Select Object tool in the toolbar of Acrobat.

Point mouse to the picture

and double left-mouse-button click to open Edit 3D dialog. Click 3D tab and then Browse button in the Script panel to load JavaScript jamberoo.js.

JavaScript jamberoo.js can be downloaded here.

Add checkbox to the document (see Adding Checkboxes tutorial).

Click Select Object tool in the toolbar of Acrobat.

Double click on a checkbox to open Check Box Properties dialog. Name it dvectors

Select Options tab and tick Check box is checked by default checkbox

Click Actions tab and select Run a JavaScript in the Select Action combobox

Press Add... button to open JavaScript Editor dialog

Select and copy JavaScript code below and paste it into the JavaScript Editor dialog

// Get index of page containing the Annot3D object (count starts at 0).

pageIndex = this.pageNum;

// Index of the Annot3D (count starts at 0).

annotIndex = 0;

if (getAnnots3D(pageIndex)[0].activated) {

c3d = getAnnots3D(pageIndex)[0].context3D;

var outcome = this.getField("dvectors").value;

if ( outcome == "Yes" ) c3d.toggleDisplayOfDVectors(true);

else c3d.toggleDisplayOfDVectors(false);

}

You can see that a line with a code this.getField("dvectors").value uses the name of a checkbox, dvectors.

The final 3D PDF document is here

[Tutorial Home]


Send all questions, suggestions and comments to Vlad (vvv900@gmail.com)

Dr. Vladislav Vasilyev

Supercomputer Facility,

The Australian National University,

Canberra, ACT, 0200, Australia