打印PDF的书签为PDF的脚本

    技术2022-05-20  46

    偷自 Adobe Blog,原件是个批量处理文件。拿出来让大家看看是什么样子的。 用法,新建一个批处理(高级菜单下面找),新建,加入执行Javascript命令。然后拷贝粘贴下面的脚本就可以了。 功能好似 IntelliPDF 的 Print Bookmark,只是这脚本直接做出了PDF文件。如果要文字可以另存为txt。 我试验了Acrobat 6/7/8都可以运行。只是在6下面如果是东亚语言会有要亚洲语言支持安装的提示。 对于中东语言有英文混排的时候会乱掉,不过我不知道是不是 IntelliPDF 的 Print Bookmark 也支持中东语。 因此,总体来说已经很不错了。 ============================== /* List all Bookmarks */ /* Recursively work through bookmark tree */ function PrintBookmarks(bm, nLevel) { if (nLevel != 0) { // don't print the root bmReport.absIndent=bmTab*(nLevel-1); bmReport.writeText(util.printf("%s",bm.name)); } if (bm.children != null) for (var i = 0; i < bm.children.length; i++) PrintBookmarks(bm.children[i], nLevel + 1); } bmTab = 20; bmReport = new Report(); bmReport.size = 2; bmReport.writeText(this.title); bmReport.writeText(" "); bmReport.size = 1.5; bmReport.writeText("Listing of Bookmarks"); bmReport.writeText(" "); bmReport.size = 1; PrintBookmarks(this.bookmarkRoot, 0); global.bmRep = bmReport; // make global global.wrtDoc = app.setInterval( 'try {' +' reportDoc = global.bmRep.open("Listing of Bookmarks");' +' console.println("Executed Report.open");' +' app.clearInterval(global.wrtDoc);' +' delete global.wrtDoc;' +' console.println("Executed App.clearInterval");' +' reportDoc.info.title = "Bookmark Listings";' +' reportDoc.info.Author = "List Bookmark Sequence";' +'} catch (e) {console.println("Waiting...: " + e);}' , 100); ==============================


    最新回复(0)