/************************************************************************** * * @@@BUILDINFO@@@ acrobat-8.jsx 1.0.0.0 21-August-2006 * Copyright 2006-2007 Adobe Systems Incorporated * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of * Adobe Systems Incorporated and its suppliers, if any. The intellectual * and technical concepts contained herein are proprietary to Adobe Systems * Incorporated and its suppliers and may be covered by U.S. and Foreign * Patents,patents in process,and are protected by trade secret or copyright * law. Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained from * Adobe Systems Incorporated. **************************************************************************/ /* @@@START_XML@@@ Adobe Acrobat 8.0 This script enables other applications to communicate with Adobe Acrobat 8.0. Adobe Acrobat 8.0 Ce script permet à d'autres applications de communiquer avec Adobe Acrobat 8.0. Adobe Acrobat 8.0 このスクリプトは、他のアプリケーションと Adobe Acrobat 8.0 との通信を有効にします。 Adobe Acrobat 8.0 Mithilfe dieses Skripts können andere Anwendungen mit Adobe Acrobat 8.0 kommunizieren. Adobe Acrobat 8.0 Questo script consente ad altre applicazioni di comunicare con Adobe Acrobat 8.0 Adobe Acrobat 8.0 Este script posibilita que otras aplicaciones se comuniquen con Adobe Acrobat 8.0 Adobe Acrobat 8.0 Dit script laat andere toepassingen toe te communiceren met Adobe Acrobat 8.0 Adobe Acrobat 8.0 Este script permite que outros aplicativos se comuniquem com o Adobe Acrobat 8.0 Adobe Acrobat 8.0 Skriptet gjør at andre programmer kan kommunisere med Adobe Acrobat 8.0 Adobe Acrobat 8.0 Dette script betyder, at andre programmer kan kommunikere med Adobe Acrobat 8.0 Adobe Acrobat 8.0 Tämän komentosarjan avulla muut sovellukset ja Adobe Acrobat 8.0 voivat kommunikoida keskenään Adobe Acrobat 8.0 Det här skriptet gör det möjligt för andra program att kommunicera med Adobe Acrobat 8.0 Adobe Acrobat 8.0 "此指令碼能讓其他應用程式與 Adobe Acrobat 8.0 進行通訊。 Adobe Acrobat 8.0 "此脚本使其它应用程序能够与 Adobe Acrobat 8.0 进行通信 Adobe Acrobat 8.0 "이 스크립트를 사용하면 다른 응용 프로그램에서 Adobe Acrobat 8.0과(와) 통신할 수 있습니다. @@@END_XML@@@ */ if (typeof acrobat == "undefined") { var acrobat = new Object; acrobat.appSpec = "acrobat-8.0"; //----------------------------------------------------------------- // This routine tries to return an array of File objects created // from the 'files' argument. It will convert a single File object // or a single string into an array of File objects, or it will // convert an array of string and File objects into an array of // file objects. //----------------------------------------------------------------- acrobat.ExtractFileArray = function (files) { var fileArray = new Array; // If it isn't an array, make it a length one array. if (!(files instanceof Array)) files = new Array (files); // Turn each item in the array into a File, or remove it. for (index = 0; index < files.length; ++index) { var file = files[index]; if (file instanceof File) fileArray.push (file); else if (typeof file == 'string') fileArray.push (File (file)); else { // do nothing } } return fileArray; } /** * Open a file (or files) in Acrobat. * files may be a single file, or a list of files. * A file is represented by a JavaScript 'File' object * or a string that is the file path */ acrobat.open = function( files ) { var fileArray = acrobat.ExtractFileArray ( files ); var script = ""; for (index = 0; index < fileArray.length; ++index) { var file = fileArray[index]; script += "app.openDoc('" + file.fsName + "'); "; } acrobat.executeScript(script); BridgeTalk.bringToFront (acrobat.appSpec); } /** * format the passed in value so we can pass it in a script * This means putting quote marks around a string and escaping * any single quote the string contains. */ acrobat.format = function(value) { var valtype = typeof value; if(valtype=="string") { return "'" + value.replace (/'/g, "\\'") + "'"; } return value; } /** * Execute a JavaScript in Acrobat, * using Acrobat's EScript engine */ acrobat.executeScript = function(script) { var bt = new BridgeTalk; bt.target = acrobat.appSpec; bt.body = script; /* bt.onResult = function(btobj) { print("> '" + btobj.body + "'"); } bt.onError = function(errmsg) { print("ERROR"); var errcode = parseInt(errmsg.headers["Error-Code"]); print(errcode); print(errmsg.body); } */ return bt.send(); } /** * Reveal the active document in Bridge. */ acrobat.revealInBridge = function() { acrobat.executeScript("app.execMenuItem('ADBE:BridgeMenuName')"); } /** * Create a new file in Acrobat. * Takes two optional parameters--nHeight, nWidth * the height and width of the new document in points. * To call with optional parameter use the syntax: * acrobat.openAsNew({ nWidth: 600, nHeight: 700 }); */ acrobat.openAsNew = function() { var script = "app.newDoc("; var argcnt = 0; for(index = 0; index < arguments.length; ++index) { var arglist = arguments[index]; for(var arg in arglist) { var val = arglist[arg]; if(arg=="nWidth" || arg=="nHeight") { script += (argcnt==0) ? "{ ": ", "; script += arg + ": " + acrobat.format(val); argcnt++; } } } if(0