Began recrypt functionality

This commit is contained in:
John Whitington 2014-10-15 13:48:39 +01:00
parent 678a25191d
commit 70226120d4
1 changed files with 12 additions and 3 deletions

View File

@ -252,7 +252,8 @@ type args =
mutable labelstartval : int; mutable labelstartval : int;
mutable squeeze : bool; mutable squeeze : bool;
mutable original_filename : string; mutable original_filename : string;
mutable cpdflin : string option} mutable cpdflin : string option;
mutable recrypt : bool}
(* List of all filenames in any AND stage - this is used to check that we don't (* List of all filenames in any AND stage - this is used to check that we don't
overwrite any input file when -dont-overwrite-existing-files is used. *) overwrite any input file when -dont-overwrite-existing-files is used. *)
@ -330,7 +331,8 @@ let args =
labelstartval = 1; labelstartval = 1;
squeeze = false; squeeze = false;
original_filename = ""; original_filename = "";
cpdflin = None} cpdflin = None;
recrypt = false}
let reset_arguments () = let reset_arguments () =
args.op <- None; args.op <- None;
@ -401,7 +403,8 @@ let reset_arguments () =
args.labelstyle <- Pdfpagelabels.DecimalArabic; args.labelstyle <- Pdfpagelabels.DecimalArabic;
args.labelprefix <- None; args.labelprefix <- None;
args.labelstartval <- 1; args.labelstartval <- 1;
args.squeeze <- false args.squeeze <- false;
args.recrypt <- false
(* Do not reset original_filename or cpdflin, since we want it to work across ANDs. *) (* Do not reset original_filename or cpdflin, since we want it to work across ANDs. *)
let banlist_of_args () = let banlist_of_args () =
@ -1152,6 +1155,9 @@ let setlabelstartval i =
let setcpdflin s = let setcpdflin s =
args.cpdflin <- Some s args.cpdflin <- Some s
let setrecrypt b =
args.recrypt <- b
(* 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
@ -1202,6 +1208,9 @@ and specs =
("-cpdflin", ("-cpdflin",
Arg.String setcpdflin, Arg.String setcpdflin,
" Set location of 'cpdflin'"); " Set location of 'cpdflin'");
("-recrypt",
Arg.Bool setrecrypt,
" Keep this file's encryption when writing");
("-raw", ("-raw",
Arg.Unit (setencoding Cpdf.Raw), Arg.Unit (setencoding Cpdf.Raw),
" Do not process text"); " Do not process text");