more inline functions
This commit is contained in:
parent
4aff78a3e3
commit
f96fb35ab3
|
@ -1001,21 +1001,6 @@ let fixdashes s =
|
||||||
let chars = explode s in
|
let chars = explode s in
|
||||||
implode (bufferdashes chars)
|
implode (bufferdashes chars)
|
||||||
|
|
||||||
let encrypt_to_collect = ref 0
|
|
||||||
|
|
||||||
let setmethod s =
|
|
||||||
detect_duplicate_op Encrypt;
|
|
||||||
if args.op = None then args.op <- Some Encrypt; (* Could be additional to -split *)
|
|
||||||
match s with
|
|
||||||
| "40bit" | "128bit" | "AES" | "AES256" | "AES256ISO" -> args.crypt_method <- s
|
|
||||||
| _ -> error ("Unsupported encryption method " ^ s)
|
|
||||||
|
|
||||||
let setowner s =
|
|
||||||
args.owner <- s
|
|
||||||
|
|
||||||
let setuser s =
|
|
||||||
args.user <- s
|
|
||||||
|
|
||||||
let set_input_image f s =
|
let set_input_image f s =
|
||||||
try
|
try
|
||||||
let fh = open_in_bin s in
|
let fh = open_in_bin s in
|
||||||
|
@ -1037,13 +1022,21 @@ let set_input_jbig2 s =
|
||||||
set_input_image
|
set_input_image
|
||||||
(fun () -> Cpdfimage.obj_of_jbig2_data ?global:!jbig2_global) s;
|
(fun () -> Cpdfimage.obj_of_jbig2_data ?global:!jbig2_global) s;
|
||||||
args.remove_duplicate_streams <- true
|
args.remove_duplicate_streams <- true
|
||||||
|
let encrypt_to_collect = ref 0
|
||||||
|
|
||||||
|
let setmethod s =
|
||||||
|
detect_duplicate_op Encrypt;
|
||||||
|
if args.op = None then args.op <- Some Encrypt; (* Could be additional to -split *)
|
||||||
|
match s with
|
||||||
|
| "40bit" | "128bit" | "AES" | "AES256" | "AES256ISO" -> args.crypt_method <- s
|
||||||
|
| _ -> error ("Unsupported encryption method " ^ s)
|
||||||
|
|
||||||
let anon_fun s =
|
let anon_fun s =
|
||||||
try
|
try
|
||||||
match !encrypt_to_collect with
|
match !encrypt_to_collect with
|
||||||
| 3 -> setmethod s; decr encrypt_to_collect
|
| 3 -> setmethod s; decr encrypt_to_collect
|
||||||
| 2 -> setowner s; decr encrypt_to_collect
|
| 2 -> args.owner <- s; decr encrypt_to_collect
|
||||||
| 1 -> setuser s; decr encrypt_to_collect
|
| 1 -> args.user <- s; decr encrypt_to_collect
|
||||||
| 0 ->
|
| 0 ->
|
||||||
let before, after = cleavewhile (neq '=') (explode s) in
|
let before, after = cleavewhile (neq '=') (explode s) in
|
||||||
begin match implode before with
|
begin match implode before with
|
||||||
|
@ -1344,12 +1337,6 @@ let setcenter n =
|
||||||
args.position <- Cpdfposition.Centre;
|
args.position <- Cpdfposition.Centre;
|
||||||
args.justification <- Cpdfaddtext.CentreJustify
|
args.justification <- Cpdfaddtext.CentreJustify
|
||||||
|
|
||||||
let setbatespad n =
|
|
||||||
args.batespad <- Some n
|
|
||||||
|
|
||||||
let setbates n =
|
|
||||||
args.bates <- n
|
|
||||||
|
|
||||||
(* Calculate -bates automatically so that n is applied to the first page in the range *)
|
(* Calculate -bates automatically so that n is applied to the first page in the range *)
|
||||||
let setbatesrange n =
|
let setbatesrange n =
|
||||||
let first_page =
|
let first_page =
|
||||||
|
@ -1358,41 +1345,11 @@ let setbatesrange n =
|
||||||
in
|
in
|
||||||
args.bates <- n + 1 - first_page
|
args.bates <- n + 1 - first_page
|
||||||
|
|
||||||
let setkeepversion () =
|
|
||||||
args.keepversion <- true
|
|
||||||
|
|
||||||
let setbycolumns () =
|
|
||||||
args.bycolumns <- true
|
|
||||||
|
|
||||||
let setpagerotation r =
|
let setpagerotation r =
|
||||||
match r with
|
match r with
|
||||||
| 90 | 270 -> args.pagerotation <- r
|
| 90 | 270 -> args.pagerotation <- r
|
||||||
| _ -> error "Bad Page rotation. Try 90 or 270."
|
| _ -> error "Bad Page rotation. Try 90 or 270."
|
||||||
|
|
||||||
let set_no_edit () =
|
|
||||||
args.no_edit <- true
|
|
||||||
|
|
||||||
let set_no_print () =
|
|
||||||
args.no_print <- true
|
|
||||||
|
|
||||||
let set_no_copy () =
|
|
||||||
args.no_copy <- true
|
|
||||||
|
|
||||||
let set_no_annot () =
|
|
||||||
args.no_annot <- true
|
|
||||||
|
|
||||||
let set_no_forms () =
|
|
||||||
args.no_forms <- true
|
|
||||||
|
|
||||||
let set_no_extract () =
|
|
||||||
args.no_extract <- true
|
|
||||||
|
|
||||||
let set_no_assemble () =
|
|
||||||
args.no_assemble <- true
|
|
||||||
|
|
||||||
let set_no_hq_print () =
|
|
||||||
args.no_hq_print <- true
|
|
||||||
|
|
||||||
let set_input s =
|
let set_input s =
|
||||||
args.original_filename <- s;
|
args.original_filename <- s;
|
||||||
args.inputs <- (InFile s, "all", "", "", ref false, None)::args.inputs
|
args.inputs <- (InFile s, "all", "", "", ref false, None)::args.inputs
|
||||||
|
@ -1988,7 +1945,7 @@ and specs =
|
||||||
Arg.Unit (fun () -> args.create_objstm <- true),
|
Arg.Unit (fun () -> args.create_objstm <- true),
|
||||||
" Create object streams anew");
|
" Create object streams anew");
|
||||||
("-keep-version",
|
("-keep-version",
|
||||||
Arg.Unit setkeepversion,
|
Arg.Unit (fun () -> args.keepversion <- true),
|
||||||
" Don't change the version number");
|
" Don't change the version number");
|
||||||
("-l",
|
("-l",
|
||||||
Arg.Unit (fun () -> args.linearize <- true),
|
Arg.Unit (fun () -> args.linearize <- true),
|
||||||
|
@ -2151,14 +2108,14 @@ and specs =
|
||||||
("-decrypt-force",
|
("-decrypt-force",
|
||||||
Arg.Unit setdebugforce,
|
Arg.Unit setdebugforce,
|
||||||
" Decrypt a file even without password");
|
" Decrypt a file even without password");
|
||||||
("-no-edit", Arg.Unit set_no_edit, " No edits");
|
("-no-edit", Arg.Unit (fun () -> args.no_edit <- true) , " No edits");
|
||||||
("-no-print", Arg.Unit set_no_print, " No printing");
|
("-no-print", Arg.Unit (fun () -> args.no_print <- true), " No printing");
|
||||||
("-no-copy", Arg.Unit set_no_copy, " No copying");
|
("-no-copy", Arg.Unit (fun () -> args.no_copy <- true), " No copying");
|
||||||
("-no-annot", Arg.Unit set_no_annot, " No annotations");
|
("-no-annot", Arg.Unit (fun () -> args.no_annot <- true), " No annotations");
|
||||||
("-no-forms", Arg.Unit set_no_forms, " No forms");
|
("-no-forms", Arg.Unit (fun () -> args.no_forms <- true), " No forms");
|
||||||
("-no-extract", Arg.Unit set_no_extract, " No extracting");
|
("-no-extract", Arg.Unit (fun () -> args.no_extract <- true), " No extracting");
|
||||||
("-no-assemble", Arg.Unit set_no_assemble, " No assembling");
|
("-no-assemble", Arg.Unit (fun () -> args.no_assemble <- true), " No assembling");
|
||||||
("-no-hq-print", Arg.Unit set_no_hq_print, " No high quality printing");
|
("-no-hq-print", Arg.Unit (fun () -> args.no_hq_print <- true), " No high quality printing");
|
||||||
("-no-encrypt-metadata",
|
("-no-encrypt-metadata",
|
||||||
Arg.Unit set_no_encrypt_metadata,
|
Arg.Unit set_no_encrypt_metadata,
|
||||||
" Don't encrypt metadata (AES only)");
|
" Don't encrypt metadata (AES only)");
|
||||||
|
@ -2232,13 +2189,13 @@ and specs =
|
||||||
Arg.String setrectangle,
|
Arg.String setrectangle,
|
||||||
" Add a rectangle to the page");
|
" Add a rectangle to the page");
|
||||||
("-bates",
|
("-bates",
|
||||||
Arg.Int setbates,
|
Arg.Int (fun n -> args.bates <- n),
|
||||||
" Set the base bates number");
|
" Set the base bates number");
|
||||||
("-bates-at-range",
|
("-bates-at-range",
|
||||||
Arg.Int setbatesrange,
|
Arg.Int setbatesrange,
|
||||||
" Set the base bates number at first page in range");
|
" Set the base bates number at first page in range");
|
||||||
("-bates-pad-to",
|
("-bates-pad-to",
|
||||||
Arg.Int setbatespad,
|
Arg.Int (fun n -> args.batespad <- Some n),
|
||||||
" Pad the bates number with leading zeroes to width");
|
" Pad the bates number with leading zeroes to width");
|
||||||
("-font",
|
("-font",
|
||||||
Arg.String setfont,
|
Arg.String setfont,
|
||||||
|
|
Loading…
Reference in New Issue