我为Acrobat Reader创建了Javascript,允许您保存当前打开的标签。它添加了菜单项:“保存选项卡”,“加载选项卡”和“切换自动加载”。它保存标签和页码,并恢复它们。
这对Linux来说特别有用,因为Linux的pdf阅读器不多。但是,我无法弄清楚如何捕获打开或关闭文档事件,或者设置一些计时器事件以自动存储当前的选项卡列表。
Here is the original API reference适用于Adobe Acrobat。
/*
Here is the script, put it in $HOME/.adobe/Acrobat/9.0/JavaScripts (or in
the equivalent program files folder under Windows,) and it will automatically
be loaded.
When you need to save current state, choose menu "view -> Save Tabs", to restore
recently saved tabs choose "view -> Load Tabs".
*/
var delim = '|';
var parentMenu = "View";
/*
Loading Saved Tabs
*/
function LoadTabs() {
if (global.tabs_opened == null) {
return;
}
var flat = global.tabs_opened.split(delim);
for (i = 0; i < flat.length; i += 2) {
try {
app.openDoc(flat[i]);
app.execMenuItem("FirstPage");
for (ii = 0; ii < flat[i + 1]; ++ii) {
app.execMenuItem("NextPage");
}
} catch (ee) {
app.alert("Error while opening the requested document.\n" + flat[i], 3);
}
}
}
/*
Function with trusted section returning opened documents
*/
trustedActiveDocs = app.trustedFunction(function () {
app.beginPriv();
var d = app.activeDocs;
app.endPriv();
return d;
})
/*
Saving Tabs that are opened
*/
function SaveTabs() {
var d = trustedActiveDocs();
var tabs = '';
for (var i = 0; i < d.length; i++) {
if (i > 0)
tabs += delim;
// app.alert(d[i].path+"------"+d[i].pageNum,3);
tabs += d[i].path;
tabs += delim;
tabs += d[i].pageNum;
}
global.tabs_opened = tabs;
global.setPersistent("tabs_opened", true);
app.alert("Tabs Saved", 3);
}
/*
Toggle auto load tabs
automatically loading tabs when reader starts
*/
function ToggleAuto() {
if (global.tabs_auto == 0 || global.tabs_auto == null) {
global.tabs_auto = 1;
global.setPersistent("tabs_auto", true);
app.alert("Tabs auto loading enabled", 3);
} else {
global.tabs_auto = 0;
global.setPersistent("tabs_auto", true);
app.alert("Tabs auto loading disabled", 3);
}
}
app.addMenuItem({
cName: "-",
cParent: parentMenu,
cExec: "void(0);"
});
app.addMenuItem({
cName: "&Save Tabs",
cParent: parentMenu,
cExec: "SaveTabs();"
});
app.addMenuItem({
cName: "&Load Tabs",
cParent: parentMenu,
cExec: "LoadTabs();"
});
app.addMenuItem({
cName: "Toggle auto load",
cParent: parentMenu,
cExec: "ToggleAuto();"
});
if (global.tabs_auto == 1) {
LoadTabs();
}
答案 0 :(得分:1)
感谢从一个成熟的产品开始实施glaring feature omission。 Autohotkey脚本将满足您的需求。我在下面创建了一个,当您关闭Acrobat时将自动保存标签布局。
此脚本可与最新版本的Acrobat Pro DC一起使用。在此版本中,脚本菜单选项显示在“视图”菜单的底部。如果您的版本不同,则必须修改此脚本。如果您的Acrobat版本将自定义Javascript菜单选项放在其他位置,请在评论中报告。
if WinActive("ahk_class #32770") & WinActive("Adobe Acrobat", "Do you want to close all tabs or the current tab") {
Send, !c
WinWaitActive, ahk_class AcrobatSDIWindow
Send, !v{Up 3}{Enter}
WinWaitActive, Warning: JavaScript, Tabs Saved
Send, {Space}
WinMenuSelectItem, ahk_class AcrobatSDIWindow, , View, Save Tabs
Send, ^q
}