// add_Transparency.js /* This Acrobat Javascript will add a transparent character to all the pages entered into the dialog box, seperated by commas. */ //------------ Dialog Box -------------------\\ var JSADMDlg1 = { result:"cancel", DoDialog: function(){return app.execDialog(this);}, stredt1:"", GetRadioSel:function(oRslts,aCtrls) { for(var strRtn=aCtrls[0];aCtrls.length>0;strRtn=aCtrls.pop()) { if(oRslts[strRtn] == true) return strRtn; } return ""; }, initialize: function(dialog) { var dlgInit = { "edt1": this.stredt1, }; dlgInit[this.strGRP1] = true; dialog.load(dlgInit); }, commit: function(dialog) { var oRslt = dialog.store(); this.stredt1 = oRslt["edt1"]; }, description: { name: "JSADM Dialog", elements: [ { type: "view", width: 241, elements: [ { type: "static_text", item_id: "ttl1", name: "Add Transparency", font: "dialog", bold: true, }, { type: "cluster", name: "Add transparency to pages:", width: 200, align_children:"align_row", elements: [ { type: "static_text", item_id: "stat", name: "Start", alignment: "align_left", font: "dialog", }, { type: "edit_text", item_id: "edt1", char_width: 30, }, ] }, { type: "ok_cancel", }, ] }, ] } }; // Default dialog box values JSADMDlg1.stredt1 = ""; //Write dialog box values to console for debugging if("ok" == JSADMDlg1.DoDialog()) { console.println("edt1:" + JSADMDlg1.stredt1); } ///-----------End of Dialog box---------------\\ //------------ Begin -----------------------\\ var myPageAmount = this.numPages; var myPageCheck = false; var myPageList = JSADMDlg1.stredt1; var myPageListArray = myPageList.split(","); var myPageListAmount = myPageListArray.length; for (i = 0; i <= myPageAmount; i += 1) { for (j = 0; j <= myPageListAmount; j +=1) { myCurrentPage = i + 1; if (myCurrentPage == myPageListArray[j]) { myPageCheck = true; } } if (myPageCheck == true) { this.addWatermarkFromText({ cText: "_", nOpacity: 0, // transparent nStart: i, nEnd: i, nFontSize: 9, nTextAlign: app.constants.align.left, nHorizAlign: app.constants.align.left, nVertAlign: app.constants.align.bottom, nHorizValue: 75, nVertValue: 20 }); myPageCheck = false; } }