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

15
cpdf.ml Normal file → Executable file
View File

@ -24,16 +24,25 @@ let find_cpdflin provided =
Some x -> Some x Some x -> Some x
| None -> | None ->
if Sys.file_exists "cpdflin" then Some "cpdflin" else 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 match option_map (is_at_path "cpdflin") (paths ()) with
h::_ -> Some h 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 (* Call cpdflin, given the (temp) input name, the output name, and the location
of the cpdflin binary. Returns the exit code. *) of the cpdflin binary. Returns the exit code. *)
let call_cpdflin cpdflin temp output best_password = let call_cpdflin cpdflin temp output best_password =
let command = let command =
cpdflin ^ " " ^ Filename.quote temp ^ match Sys.os_type with
" \"" ^ best_password ^ "\" " ^ Filename.quote output "Win32" ->
cpdflin ^ " --linearize " ^
Filename.quote temp ^ " " ^ Filename.quote output
| _ ->
cpdflin ^ " " ^ Filename.quote temp ^
" \"" ^ best_password ^ "\" " ^ Filename.quote output
in in
Sys.command command Sys.command command