From 24d6f02e060bd6917312e38672aaa21abd63da63 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 6 Jan 2021 13:41:14 +0000 Subject: [PATCH] Allow -pw=password so passwords may begin with a dash --- cpdfcommand.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 94068a1..ba740e6 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3,7 +3,7 @@ let demo = false let noncomp = false let major_version = 2 let minor_version = 4 -let version_date = "(devel, 21st December 2020)" +let version_date = "(devel, 6th January 2020)" open Pdfutil open Pdfio @@ -871,6 +871,8 @@ let anon_fun s = | (a, _, d, e, f, g)::t -> args.inputs <- (a, fixdashes s, d, e, f, g)::t +(* If a password begins with a dash, we allow -pw= too *) +let setdashpassword = anon_fun (*let firstpage pdf = List.hd (Pdfpage.pages_of_pagetree pdf)*) @@ -1513,6 +1515,8 @@ let whingemalformed () = prerr_string "Command line must be of exactly the form\ncpdf -gs -gs-malformed-force -o \n"; exit 1 + + let nothing () = () (* Parse a control file, make an argv, and then make Arg parse it. *) @@ -2191,6 +2195,7 @@ and specs = ("-fix-prince", Arg.Unit (setop RemoveUnusedResources), ""); ("-extract-text", Arg.Unit (setop ExtractText), ""); ("-extract-text-font-size", Arg.Float setextracttextfontsize, ""); + ("-pw", Arg.String setdashpassword, ""); ] and usage_msg =