Last active
December 14, 2015 12:28
Revisions
-
altmind revised this gist
Mar 4, 2013 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,6 @@ ProcessDocument = app.trustedFunction(function () { newDoc.deletePages(0); } for (var i = 0; i < newDoc.numPages; i++) { if (i < startFrom) continue; @@ -63,7 +62,6 @@ ProcessDocument = app.trustedFunction(function () { app.endPriv(); }); app.addMenuItem({ cName: "splitPagesJS", cUser: "Split Pages", -
altmind created this gist
Mar 4, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,82 @@ ProcessDocument = app.trustedFunction(function () { app.beginPriv(); var newDoc = app.newDoc(); var p = app.response("Start with page(default 0 - process all pages)?", "Query", "0"); var startFrom = parseInt(p) || 0; var i = 0; while (i < this.numPages) { newDoc.insertPages({ nPage: newDoc.numPages - 1, cPath: this.path, nStart: i }); if (i >= startFrom) { newDoc.insertPages({ nPage: newDoc.numPages - 1, cPath: this.path, nStart: i }); } i++; } if (newDoc.numPages > 1) { newDoc.deletePages(0); } for (var i = 0; i < newDoc.numPages; i++) { if (i < startFrom) continue; var cropRect = newDoc.getPageBox("Crop", i); var halfWidth = (cropRect[2] - cropRect[0]) / 2; var cropLeft = new Array(); cropLeft[0] = cropRect[0]; cropLeft[1] = cropRect[1]; cropLeft[2] = cropRect[0] + halfWidth; cropLeft[3] = cropRect[3]; var cropRight = new Array(); cropRight[0] = cropRect[2] - halfWidth; cropRight[1] = cropRect[1]; cropRight[2] = cropRect[2]; cropRight[3] = cropRect[3]; if (i % 2 == 0) { newDoc.setPageBoxes({ cBox: "Crop", nStart: i, rBox: cropLeft }); } else { newDoc.setPageBoxes({ cBox: "Crop", nStart: i, rBox: cropRight }); } } app.endPriv(); }); // add the menu item app.addMenuItem({ cName: "splitPagesJS", cUser: "Split Pages", cParent: "Document", cExec: "ProcessDocument()", cEnable: "event.rc = (event.target != null);", nPos: 0 }); app.addToolButton({ cName: "splitPagesJSTB", cExec: "ProcessDocument()", cTooltext: "Split Pages", cLabel: "Split Pages", cEnable: true, nPos: 0 });