Mapping with Adobe PDF Bookmarks (Part 1)
There are quite a few very useful tasks that can be accomplished using Javascripts in a PDF file but not everyone is familiar with how to go about implementing them. The two most popular ways are:
- The folder-level script that will work with any PDF file open on your desktop and
- An embedded script that is distributed with each individual PDF file
var geo = TGO.PDFPointGetGeo(gti.mapFrame, gti.pdfPoint);
var lAppTask = this.getField("app.task").value;
var lAppLat = this.getField("app.lat").value;
var lAppLong = this.getField("app.long").value;
var lWeb = this.getField("web").value;
if (lWeb == "Yes") // we are submitting via a web server
{
var fieldsToSubmit = new Array ("app.name","app.task","gti.lat","gti.long");
this.submitForm("http://127.0.0.1/jobs.asp#FDF",true,false,fieldsToSubmit);
}
else
{
var con = ADBC.newConnection("fieldform");
var statement = con.newStatement();
var query = "INSERT INTO jobs ( name, task, lat, long) values ('" + lAppName + "','" + lAppTask + "','" + lAppLat + "','" + lAppLong + "');";
statement.execute(query);
}
When you select the "Add" option, you will be prompted to copy and paste your script in to the Adobe Javascript Editor. Select to "Save" the file and then test your changes. You can debug your script by selecting "ctrl J".
This functionality is incredibally useful for working with forms like in this example but you can also use it to send and recieve information to web services like Google Maps and Yahoo. Download the Javascript example GeoPDF from here and test the Bookmarks for yourself. To access Adobe's Guide to Javascripting click here. Happy programming!






