more
This commit is contained in:
parent
c82071546e
commit
9f981fb344
|
@ -182,6 +182,7 @@ type op =
|
||||||
| SetMetadataDate of string
|
| SetMetadataDate of string
|
||||||
| CreateMetadata
|
| CreateMetadata
|
||||||
| EmbedMissingFonts
|
| EmbedMissingFonts
|
||||||
|
| BookmarksOpenToLevel of int
|
||||||
|
|
||||||
let string_of_op = function
|
let string_of_op = function
|
||||||
| CopyFont _ -> "CopyFont"
|
| CopyFont _ -> "CopyFont"
|
||||||
|
@ -297,6 +298,7 @@ let string_of_op = function
|
||||||
| SetMetadataDate _ -> "SetMetadataDate"
|
| SetMetadataDate _ -> "SetMetadataDate"
|
||||||
| CreateMetadata -> "CreateMetadata"
|
| CreateMetadata -> "CreateMetadata"
|
||||||
| EmbedMissingFonts -> "EmbedMissingFonts"
|
| EmbedMissingFonts -> "EmbedMissingFonts"
|
||||||
|
| BookmarksOpenToLevel _ -> "BookmarksOpenToLevel"
|
||||||
|
|
||||||
(* Inputs: filename, pagespec. *)
|
(* Inputs: filename, pagespec. *)
|
||||||
type input_kind =
|
type input_kind =
|
||||||
|
@ -639,7 +641,7 @@ let banned banlist = function
|
||||||
| ListBookmarks | ImageResolution _ | MissingFonts
|
| ListBookmarks | ImageResolution _ | MissingFonts
|
||||||
| PrintPageLabels | Clean | Compress | Decompress
|
| PrintPageLabels | Clean | Compress | Decompress
|
||||||
| RemoveUnusedResources | ChangeId | CopyId _ | ListSpotColours | Version
|
| RemoveUnusedResources | ChangeId | CopyId _ | ListSpotColours | Version
|
||||||
| DumpAttachedFiles | RemoveMetadata | EmbedMissingFonts -> false (* Always allowed *)
|
| DumpAttachedFiles | RemoveMetadata | EmbedMissingFonts | BookmarksOpenToLevel _ -> false (* Always allowed *)
|
||||||
(* Combine pages is not allowed because we would not know where to get the
|
(* Combine pages is not allowed because we would not know where to get the
|
||||||
-recrypt from -- the first or second file? *)
|
-recrypt from -- the first or second file? *)
|
||||||
| ExtractText | ExtractImages | ExtractFontFile
|
| ExtractText | ExtractImages | ExtractFontFile
|
||||||
|
@ -1618,6 +1620,9 @@ let setmergeaddbookmarks () =
|
||||||
let setmergeaddbookmarksusetitles () =
|
let setmergeaddbookmarksusetitles () =
|
||||||
args.merge_add_bookmarks_use_titles <- true
|
args.merge_add_bookmarks_use_titles <- true
|
||||||
|
|
||||||
|
let setbookmarksopentolevel l =
|
||||||
|
args.op <- Some (BookmarksOpenToLevel l)
|
||||||
|
|
||||||
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
||||||
let rec make_control_argv_and_parse filename =
|
let rec make_control_argv_and_parse filename =
|
||||||
control_args := !control_args @ parse_control_file filename
|
control_args := !control_args @ parse_control_file filename
|
||||||
|
@ -1834,6 +1839,9 @@ and specs =
|
||||||
("-add-bookmarks",
|
("-add-bookmarks",
|
||||||
Arg.String setaddbookmarks,
|
Arg.String setaddbookmarks,
|
||||||
" Add bookmarks from the given file");
|
" Add bookmarks from the given file");
|
||||||
|
("-bookmarks-open-to-level",
|
||||||
|
Arg.Int setbookmarksopentolevel,
|
||||||
|
" Open bookmarks to this level (0 = all closed)");
|
||||||
("-presentation",
|
("-presentation",
|
||||||
Arg.Unit (setop Presentation),
|
Arg.Unit (setop Presentation),
|
||||||
" Make a presentation");
|
" Make a presentation");
|
||||||
|
@ -3491,6 +3499,15 @@ let add_bookmark_title filename use_title pdf =
|
||||||
in
|
in
|
||||||
Pdfmarks.add_bookmarks newmarks pdf
|
Pdfmarks.add_bookmarks newmarks pdf
|
||||||
|
|
||||||
|
let bookmarks_open_to_level n pdf =
|
||||||
|
let marks = Pdfmarks.read_bookmarks pdf in
|
||||||
|
let newmarks =
|
||||||
|
List.map
|
||||||
|
(fun m -> {m with Pdfmarks.isopen = true(*m.Pdfmarks.level < n*)})
|
||||||
|
marks
|
||||||
|
in
|
||||||
|
Pdfmarks.add_bookmarks newmarks pdf
|
||||||
|
|
||||||
(* Main function *)
|
(* Main function *)
|
||||||
let go () =
|
let go () =
|
||||||
match args.op with
|
match args.op with
|
||||||
|
@ -4346,6 +4363,9 @@ let go () =
|
||||||
| _ -> error "Output method not supported for -embed-missing-fonts"
|
| _ -> error "Output method not supported for -embed-missing-fonts"
|
||||||
in
|
in
|
||||||
embed_missing_fonts fi fo
|
embed_missing_fonts fi fo
|
||||||
|
| Some (BookmarksOpenToLevel n) ->
|
||||||
|
let pdf = get_single_pdf args.op false in
|
||||||
|
write_pdf false (bookmarks_open_to_level n pdf)
|
||||||
|
|
||||||
let parse_argv () =
|
let parse_argv () =
|
||||||
if args.debug then
|
if args.debug then
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
%FIXME: Document -gs gs -gs-malformed
|
%FIXME: Document -gs gs -gs-malformed
|
||||||
%FIXME: Document -gs gs -gs-embed-fonts
|
%FIXME: Document -gs gs -gs-embed-fonts
|
||||||
%FIXME: Document -merge-add-bookmarks, -merge-add-bookmarks-use-titles
|
%FIXME: Document -merge-add-bookmarks, -merge-add-bookmarks-use-titles
|
||||||
|
%FIXME: Document -bookmarks-open-to-level <n>
|
||||||
|
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
\usepackage{palatino}
|
\usepackage{palatino}
|
||||||
|
|
Loading…
Reference in New Issue