This commit is contained in:
John Whitington 2021-10-26 17:32:36 +01:00
parent 3fcd64332e
commit 3bf5218670
2 changed files with 21 additions and 4 deletions

View File

@ -464,7 +464,8 @@ type args =
mutable impose_center : bool; mutable impose_center : bool;
mutable impose_margin : float; mutable impose_margin : float;
mutable impose_spacing : float; mutable impose_spacing : float;
mutable impose_linewidth : float} mutable impose_linewidth : float;
mutable bookmarks_json : bool}
let args = let args =
{op = None; {op = None;
@ -577,7 +578,8 @@ let args =
impose_center = false; impose_center = false;
impose_margin = 0.; impose_margin = 0.;
impose_spacing = 0.; impose_spacing = 0.;
impose_linewidth = 0.} impose_linewidth = 0.;
bookmarks_json = false}
let reset_arguments () = let reset_arguments () =
args.op <- None; args.op <- None;
@ -675,7 +677,8 @@ let reset_arguments () =
args.impose_center <- false; args.impose_center <- false;
args.impose_margin <- 0.; args.impose_margin <- 0.;
args.impose_spacing <- 0.; args.impose_spacing <- 0.;
args.impose_linewidth <- 0. args.impose_linewidth <- 0.;
args.bookmarks_json <- true
(* Do not reset original_filename or cpdflin or was_encrypted or (* Do not reset original_filename or cpdflin or was_encrypted or
* was_decrypted_with_owner or recrypt or producer or creator or path_to_* or * was_decrypted_with_owner or recrypt or producer or creator or path_to_* or
* gs_malformed or gs_quiet, since we want these to work across ANDs. Or * gs_malformed or gs_quiet, since we want these to work across ANDs. Or
@ -1061,6 +1064,14 @@ let setopacity o =
let setaddbookmarks s = let setaddbookmarks s =
setop (AddBookmarks s) () setop (AddBookmarks s) ()
let setaddbookmarksjson s =
setop (AddBookmarks s) ();
args.bookmarks_json <- true
let setlistbookmarksjson s =
setop ListBookmarks ();
args.bookmarks_json <- true
let setstampon f = let setstampon f =
setop (StampOn f) (); setop (StampOn f) ();
(* Due to an earlier bad decision (default position), we have this nasty hack *) (* Due to an earlier bad decision (default position), we have this nasty hack *)
@ -1801,12 +1812,18 @@ and specs =
("-list-bookmarks", ("-list-bookmarks",
Arg.Unit (setop ListBookmarks), Arg.Unit (setop ListBookmarks),
" List Bookmarks"); " List Bookmarks");
("-list-bookmarks-json",
Arg.Unit setlistbookmarksjson,
" List Bookmarks in JSON format");
("-remove-bookmarks", ("-remove-bookmarks",
Arg.Unit (setop RemoveBookmarks), Arg.Unit (setop RemoveBookmarks),
" Remove bookmarks from a file"); " Remove bookmarks from a file");
("-add-bookmarks", ("-add-bookmarks",
Arg.String setaddbookmarks, Arg.String setaddbookmarks,
" Add bookmarks from the given file"); " Add bookmarks from the given file");
("-add-bookmarks-json",
Arg.String setaddbookmarksjson,
" Add bookmarks from the given file in JSON format");
("-bookmarks-open-to-level", ("-bookmarks-open-to-level",
Arg.Int setbookmarksopentolevel, Arg.Int setbookmarksopentolevel,
" Open bookmarks to this level (0 = all closed)"); " Open bookmarks to this level (0 = all closed)");

View File

@ -1560,7 +1560,7 @@ There are two options which turn off parts of the squeezer. They are \texttt{-sq
\end{framed} \end{framed}
\index{bookmarks} \index{bookmarks}
\index{document outline} \index{document outline}
PDF Bookmarks (properly called the \textit{document outline}) represent a tree PDF bookmarks (properly called the \textit{document outline}) represent a tree
of references to parts of the file, typically displayed at the side of the of references to parts of the file, typically displayed at the side of the
screen. The user can click on one to move to the specified place. \cpdf\ provides screen. The user can click on one to move to the specified place. \cpdf\ provides
facilities to list, add, and remove bookmarks. The format used by the list and facilities to list, add, and remove bookmarks. The format used by the list and