阅读PDF文档的时候发现没有书签,很麻烦。百度之,觅得答案。
在以下贴出,因部分中文显示乱码,所以改成了英文。
--------------
1)首先打开记事本输入以下代码:
for( jj= 0; jj< 3; ++jj ) {
if( ii!= 0 || jj!= 0 )
ds+= bp_delim;
ds+= data[ii][jj];
}
return new Array(0);
var record= new Array();
for( jj= 0; jj< 3 && ii< flat.length; ++ii, ++jj ) {
record.push( flat[ii] );
}
if( record.length== 3 ) {
data.push( record );
}
var d, s ;
d = new Date();
s = d.getFullYear()+"/";
s += (d.getMonth() + 1) + "/";
s += d.getDate() ;
return(s);
app.response( "书签名称,可以修改以便于记忆:",
"书签名称",
"《"+thisfilename+"》第 "+numPlugInss+" 页/共 "+this.numPages+" 页 "+currentdate,
false );
var record= new Array(3);
record[0]= label;
record[1]= this.path;
record[2]= this.pageNum;
data= GetData();
data.push( record );
SaveData( data );
if( ii!= 0 )
items+= ', ';
items+= '"'+ ii+ ': '+ data[ii][0]+ '"';
return; // exit
try {
// the document must be 'disclosed' for us to have any access
// to its properties, so we use these FirstPage NextPage calls
//
app.openDoc( data[index][1] );
app.execMenuItem( "FirstPage" );
for( ii= 0; ii< data[index][2]; ++ii ) {
app.execMenuItem( "NextPage" );
}
}
catch( ee ) {
var response=
app.alert("打开书签错误.\n是否删除本书签?", 2, 2,"删除书签");
if( response== 4 && index< data.length ) {
data.splice( index, 1 );
SaveData( data );
}
}
if( ii!= 0 )
items+= ', ';
items+= '"'+ ii+ ': '+ data[ii][0]+ '"';
return; // exit
data.splice( index, 1 );
SaveData( data );
SaveData( new Array(0) );
在以下贴出,因部分中文显示乱码,所以改成了英文。
--------------
1)首先打开记事本输入以下代码:
// bookmark_page.js, ver. 1.0
// visit: www.pdfhacks.com/bookmark_page/
// edit:cjs 2008-02-17
// 1 修改为中文标签
// 2 设置书签时可以自动获取当前的书名
// 3 自动获取当前所在的页码与总页数,方便查阅
// 4 实现更多功能可以参看Adobe Reader的SDK
// use this delimiter for serializing our array
var bp_delim= '%#%#';
function SaveData( data ) {
// data is an array of arrays that needs
// to be serialized and stored into a persistent
// global string
var ds= '';
for( ii= 0; ii< data.length; ++ii ) {
}
global.pdf_hacks_js_bookmarks= ds;
global.setPersistent( "pdf_hacks_js_bookmarks", true );
}
function GetData() {
// reverse of SaveData; return an array of arrays
if( global.pdf_hacks_js_bookmarks== null ) {
}
var flat= global.pdf_hacks_js_bookmarks.split( bp_delim );
var data= new Array();
for( ii= 0; ii< flat.length; ) {
}
return data;
}
//Get Current Date
function DateNow(){
}
function AddBookmark() {
// query the user for a name, and then combine it with
// the current PDF page to create a record; store this record
var thisfilename=this.documentFileName;
thisfilename=thisfilename.substr(0,thisfilename.lastIndexOf("."));
var numPlugInss=this.pageNum+1;
var currentdate=DateNow();
var label=
if( label!= null ) {
}
}
function ShowBookmarks() {
// show a pop-up menu; this seems to only work when
// a PDF is alreay in the viewer;
var data= GetData();
var items= '';
for( ii= 0; ii< data.length; ++ii ) {
}
// assemble the command and the execute it with eval_r()
var command= 'app.popUpMenu( '+ items+ ' );';
var selection= eval_r( command );
if( selection== null ) {
}
// the user made a selection; parse out its index and use it
// to access the bookmark record
var index= 0;
// toString() converts the String object to a string literal
// eval_r() converts the string literal to a number
index= eval_r( selection.substring( 0, selection.indexOf(':') ).toString() );
if( index< data.length ) {
}
}
function DropBookmark() {
// modelled after ShowBookmarks()
var data= GetData();
var items= '';
for( ii= 0; ii< data.length; ++ii ) {
}
var command= 'app.popUpMenu( '+ items+ ' );';
var selection= eval_r( command );
if( selection== null ) {
}
var index= 0;
index= eval_r( selection.substring( 0, selection.indexOf(':') ).toString() );
if( index< data.length ) {
}
}
function ClearBookmarks() {
if( app.alert("确认要清除所有的书签吗?", 2, 2,"删除书签" )== 4 ) {
}
}
app.addMenuItem( {
cName: "-",
// menu divider
cParent: "View",
// append to the View menu
cExec: "void(0);" } );
app.addMenuItem( {
cName: "Add a bookmark(&B)",
cParent: "View",
cExec: "AddBookmark();",
cEnable: "event.rc= (event.target != null);" } );
app.addMenuItem( {
cName: "To bookmark(&T)",
cParent: "View",
cExec: "ShowBookmarks();",
cEnable: "event.rc= (event.target != null);" } );
//cEnable: "event.rc= true;" } );
app.addMenuItem( {
cName: "Delet a bookmark(&D)",
cParent: "View",
cExec: "DropBookmark();",
cEnable: "event.rc= (event.target != null);" } );
app.addMenuItem( {
cName: "Del all bookmark(&C)",
cParent: "View",
cExec: "ClearBookmarks();",
cEnable: "event.rc= true;" } );
2)然后另存为bookmark.js,并复制到Adobe Reader的安装目录下的 reader\javascripts
3) 重新打开Adobe Reader就行了。看视图的最下面。
2)然后另存为bookmark.js,并复制到Adobe Reader的安装目录下的
3) 重新打开Adobe Reader就行了。看视图的最下面。