|
|
(같은 사용자의 중간 판 2개는 보이지 않습니다) |
1번째 줄: |
1번째 줄: |
− | http://forums.adobe.com/thread/286654 여기 참조. | + | http://pilhoon.com/post/pdf-cut-join-etc.html#collate |
| + | (cont.) |
| | | |
− | acrobat설치폴더에 acrobat/javascript/폴더 찾아서 아래 코드를 저장한 파일을 넣는다(확장자 js)
| + | <disqus></disqus> |
− | <pre> | |
− | // Complements: Planet PDF (http://www.planetpdf.com/)
| |
− | // Modified by Jeff Baitis for Acrobat 9 and Acrobat X compatibility
| |
− | // Improved Collate function with status bar.
| |
− |
| |
− | // Add a menu item to reverse all pages in the active document
| |
− | app.addMenuItem({ cName: "Reverse", cParent: "Edit", cExec: "trustedReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
| |
− | // Add a menu item to collate with another document on the filesystem
| |
− | app.addMenuItem({ cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
| |
− |
| |
− | trustedReversePages = app.trustedFunction(function()
| |
− | {
| |
− | app.beginPriv(); // Explicitly raise privileges
| |
− | var t = app.thermometer;
| |
− | t.duration = this.numPages;
| |
− | t.begin();
| |
− | for (i = this.numPages - 1; i >= 0; i--)
| |
− | {
| |
− | t.value = (i-this.numPages)*-1;
| |
− | this.movePage(i);
| |
− | t.text = 'Moving page ' + (i + 1);
| |
− | }
| |
− | t.end();
| |
− | app.endPriv();
| |
− | })
| |
− |
| |
− | // Collating pages
| |
− | /*
| |
− | Title: Collate Document
| |
− | Purpose: User is prompted to select document to insert/collate.
| |
− | Author: Sean Stewart, ARTS PDF, www.artspdf.com
| |
− | */
| |
− | | |
− | trustedCollatePages = app.trustedFunction(function()
| |
− | {
| |
− | app.beginPriv(); // Explicitly raise privileges
| |
− | // create an array to use as the rect parameter in the browse for field
| |
− |
| |
− | var arRect = new Array();
| |
− | arRect[0] = 0;
| |
− | arRect[1] = 0;
| |
− | arRect[2] = 0;
| |
− | arRect[3] = 0;
| |
− |
| |
− | // create a non-visible form field to use as a browse for field
| |
− |
| |
− | var f = this.addField("txtFilename", "text", this.numPages - 1, arRect);
| |
− |
| |
− | f.delay = true;
| |
− | f.fileSelect = true;
| |
− | f.delay = false;
| |
− |
| |
− | // user prompted to select file to collate the open document with
| |
− |
| |
− | app.alert("Select the PDF file to merge with")
| |
− |
| |
− | // open the browse for dialog
| |
− |
| |
− | f.browseForFileToSubmit();
| |
− | var evenDocPath = f.value;
| |
− |
| |
− | var q = this.numPages;
| |
− |
| |
− | var t = app.thermometer;
| |
− | t.duration = q;
| |
− | t.begin();
| |
− |
| |
− | // insert pages from selected document into open document
| |
− |
| |
− | for (var i = 0; i < q; i++) {
| |
− | var j = i*2;
| |
− | this.insertPages(j, evenDocPath, i);
| |
− | t.value = i;
| |
− | t.text = 'Inserting page ' + (i+1);
| |
− | }
| |
− | | |
− | t.end();
| |
− |
| |
− | // remove unused field
| |
− | | |
− | this.removeField("txtFilename");
| |
− | app.endPriv();
| |
− | })
| |
− | </pre>
| |
− | | |
− | acrobat을 다시 실행하면 edit메뉴에 reverse , collate메뉴가 생김.<br>
| |
− | 홀수페이지파일에서 collate실행하면 짝수페이지 파일 넣으라는 대화상자가 뜨고 실행시키면 됨.
| |