diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 8df4219..e5ce25d 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -464,7 +464,8 @@ type args = mutable impose_center : bool; mutable impose_margin : float; mutable impose_spacing : float; - mutable impose_linewidth : float} + mutable impose_linewidth : float; + mutable bookmarks_json : bool} let args = {op = None; @@ -577,7 +578,8 @@ let args = impose_center = false; impose_margin = 0.; impose_spacing = 0.; - impose_linewidth = 0.} + impose_linewidth = 0.; + bookmarks_json = false} let reset_arguments () = args.op <- None; @@ -675,7 +677,8 @@ let reset_arguments () = args.impose_center <- false; args.impose_margin <- 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 * 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 @@ -1061,6 +1064,14 @@ let setopacity o = let setaddbookmarks 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 = setop (StampOn f) (); (* Due to an earlier bad decision (default position), we have this nasty hack *) @@ -1801,12 +1812,18 @@ and specs = ("-list-bookmarks", Arg.Unit (setop ListBookmarks), " List Bookmarks"); + ("-list-bookmarks-json", + Arg.Unit setlistbookmarksjson, + " List Bookmarks in JSON format"); ("-remove-bookmarks", Arg.Unit (setop RemoveBookmarks), " Remove bookmarks from a file"); ("-add-bookmarks", Arg.String setaddbookmarks, " 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", Arg.Int setbookmarksopentolevel, " Open bookmarks to this level (0 = all closed)"); diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 1d9f4cb..e4c837b 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -1560,7 +1560,7 @@ There are two options which turn off parts of the squeezer. They are \texttt{-sq \end{framed} \index{bookmarks} \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 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