From 73d624967f9fe9b3dec49d021d8fd8ce2fec18d0 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 19 Nov 2014 13:41:53 +0000 Subject: [PATCH] Windows cpdflin support --- cpdf.ml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) mode change 100644 => 100755 cpdf.ml diff --git a/cpdf.ml b/cpdf.ml old mode 100644 new mode 100755 index 1044b7d..2e46fcc --- a/cpdf.ml +++ b/cpdf.ml @@ -24,16 +24,25 @@ let find_cpdflin provided = Some x -> Some x | None -> if Sys.file_exists "cpdflin" then Some "cpdflin" else + if Sys.file_exists "cpdflin.exe" then Some "cpdflin.exe" else match option_map (is_at_path "cpdflin") (paths ()) with h::_ -> Some h - | _ -> None + | _ -> + match option_map (is_at_path "cpdflin.exe") (paths ()) with + h::_ -> Some h + | _ -> None (* Call cpdflin, given the (temp) input name, the output name, and the location of the cpdflin binary. Returns the exit code. *) let call_cpdflin cpdflin temp output best_password = let command = - cpdflin ^ " " ^ Filename.quote temp ^ - " \"" ^ best_password ^ "\" " ^ Filename.quote output + match Sys.os_type with + "Win32" -> + cpdflin ^ " --linearize " ^ + Filename.quote temp ^ " " ^ Filename.quote output + | _ -> + cpdflin ^ " " ^ Filename.quote temp ^ + " \"" ^ best_password ^ "\" " ^ Filename.quote output in Sys.command command