Windows cpdflin support

This commit is contained in:
John Whitington 2014-11-19 13:41:53 +00:00
parent 24fb572270
commit 73d624967f
1 changed files with 12 additions and 3 deletions

9
cpdf.ml Normal file → Executable file
View File

@ -24,14 +24,23 @@ 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
| _ ->
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 =
match Sys.os_type with
"Win32" ->
cpdflin ^ " --linearize " ^
Filename.quote temp ^ " " ^ Filename.quote output
| _ ->
cpdflin ^ " " ^ Filename.quote temp ^
" \"" ^ best_password ^ "\" " ^ Filename.quote output
in