blob: c115fe89a1bbb6e11c69815c41065841a9c8b367 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<</Commands [/c << /0 [/c << /Config [/c << /UIPolicy [/i 3]
>>]
/HandlerName [/a /JavaScript]
/Params [/c << /ScriptCode [/t (/* AeB Slicing */\r\n\r\nvar sData = global.aebSliceDialogData;\r\nvar path2Save = /.*\\//i.exec\(this.path\)[0];\r\npath2Save = path2Save.substring\(0,path2Save.length-1\);\r\nvar thisPath = path2Save;\r\n\r\nvar baseName = this.documentFileName.replace\(/\\.pdf$/,""\);\r\n\r\nbaseName = \(sData.basename == "" \) ? baseName : sData.basename;\r\n\r\nvar isRelativePath = sData.relativepath;\r\nvar packageIt = sData.package\r\n\r\nif \(isRelativePath\) path2Save = thisPath + \( \(sData.path == "" \) ? "" : "/" + path2Save \);\r\nelse path2Save = \(sData.path == "" \) ? path2Save : sData.path;\r\n\r\nvar nRows = 1*sData.nRows\r\nvar nCols = 1*sData.nCols\r\n\r\nvar nPage = \(sData.page == "" \) ? 0 : 1*eval\(sData.page\);\r\n\r\nvar aRect = this.getPageBox\({cBox:"Crop",nPage:nPage}\);\r\n\r\nvar width = aRect[2]-aRect[0];\r\nvar height = aRect[1]-aRect[3];\r\n\r\nvar mWidth = width/nCols;\r\nvar mHeight = height/nRows;\r\nvar nCnt = 0;\r\n\r\nvar t = app.thermometer;\r\nt.duration = nRows*nCols;\r\nt.begin\(\);\r\n\r\nfor \( var i=0; i<nRows; i++\) {\r\n for \( var j=0; j<nCols; j++ \) {\r\n t.value = \(nCnt+1\);\r\n t.text = "Processing row " + \(i+1\) + ", column " + \(j+1\);\r\n var doc = this.extractPages\({nStart:nPage}\);\r\n doc.setPageBoxes\({\r\n cBox:"Crop",\r\n nStart:0,\r\n rBox: [\r\n j*mWidth,\r\n aRect[1]-i*mHeight,\r\n \(j+1\)*mWidth,\r\n aRect[1]-\(i+1\)*mHeight\r\n ]\r\n }\);\r\n nCnt++;\r\n cCnt = \( nCnt < 10 \) ? "0"+nCnt : ""+nCnt;\r\n if \( sData.format == "" \) {\r\n doc.saveAs\({\r\n cPath: path2Save+"/"+baseName+"_"+cCnt+".pdf"\r\n }\);\r\n } else { \r\n doc.saveAs\({\r\n cPath: path2Save+"/"+baseName+"_"+cCnt+"."+sData.ext,\r\n cConvID: sData.format\r\n }\);\r\n }\r\n doc.closeDoc\(true\);\r\n }\r\n}\r\nt.end\(\);\r\n// t = app.thermometer;\r\nif \( packageIt && \(sData.ext == "pdf"\)\) {\r\n t.value = 0;\r\n t.duration = nCnt;\r\n var doc = app.newDoc\({ nWidth: width, nHeight: height }\);\r\n\r\n for \( var i=1; i<= nCnt; i++ \) { \r\n cCnt = \( i < 10 \) ? "0"+i : ""+i;\r\n t.value = i;\r\n t.text = "Packaging slices: " + baseName+"_"+cCnt+".pdf";\r\n doc.insertPages\({nPage: i-1, cPath: path2Save+"/"+baseName+"_"+cCnt+".pdf", nStart: 0 }\);\r\n }\r\n doc.deletePages\({ nStart: 0 }\);\r\n t.text = "Saving package file: " + baseName+"_package.pdf";\r\n doc.saveAs\({ cPath: path2Save+"/"+baseName+"_package.pdf" }\);\r\n doc.closeDoc\(true\);\r\n// t.end\(\)\r\n console.println\("\\nPackaged Icon file created, save to " + path2Save+"/"+baseName+"_package.pdf"\);\r\n}\r\n)]
/ScriptName [/t ()]
>>]
/Title [/t (Execute JavaScript)]
>>]
>>]
/Input [/c << /FileVariation [/i 3]
/SourceFileOptions [/c <<>>]
>>]
/Output [/c << /AddToBaseName [/b false]
/DontOverwrite [/b false]
/FileVariation [/i 2]
/InsertAfterBaseName [/t ()]
/InsertBeforeBaseName [/t ()]
/OptimizePDF [/b true]
/PresetName [/t (Standard)]
/RunPDFOptimizer [/b false]
>>]
>>
|