This commit is contained in:
John Whitington 2023-02-21 14:50:07 +00:00
parent 844933e2da
commit 17a742250e
2 changed files with 17 additions and 13 deletions

View File

@ -749,8 +749,8 @@ let find_cpdflin provided =
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 ^ " --linearize " ^ " --password=" ^ best_password ^ " " ^ Filename.quote_command cpdflin
Filename.quote temp ^ " " ^ Filename.quote output ["--linearize"; ("--password=" ^ best_password); temp; output]
in in
match Sys.os_type with match Sys.os_type with
"Win32" -> "Win32" ->
@ -766,8 +766,8 @@ let call_cpdflin cpdflin temp output best_password =
Sys.command command Sys.command command
| _ -> | _ ->
let command = let command =
"DYLD_FALLBACK_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ "DYLD_FALLBACK_LIBRARY_PATH=" ^ Filename.quote (Filename.dirname cpdflin) ^ " " ^
"LD_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ "LD_LIBRARY_PATH=" ^ Filename.quote (Filename.dirname cpdflin) ^ " " ^
command command
in in
if args.debug then prerr_endline command; if args.debug then prerr_endline command;
@ -2888,9 +2888,9 @@ let mend_pdf_file_with_ghostscript filename =
let tmpout = Filename.temp_file "cpdf" ".pdf" in let tmpout = Filename.temp_file "cpdf" ".pdf" in
tempfiles := tmpout::!tempfiles; tempfiles := tmpout::!tempfiles;
let gscall = let gscall =
args.path_to_ghostscript ^ Filename.quote_command args.path_to_ghostscript
" -dNOPAUSE " ^ (if args.gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ Filename.quote tmpout ^ ((if args.gs_quiet then ["-dQUIET"] else []) @
" -dBATCH " ^ Filename.quote filename ["-dNOPAUSE"; "-sDEVICE=pdfwrite"; "-sOUTPUTFILE=" ^ tmpout; "-dBATCH"; filename])
in in
match Sys.command gscall with match Sys.command gscall with
| 0 -> Printf.eprintf "Succeeded!\n%!"; flush stderr; tmpout | 0 -> Printf.eprintf "Succeeded!\n%!"; flush stderr; tmpout
@ -4369,9 +4369,9 @@ let gs_malformed_force fi fo =
exit 2 exit 2
end; end;
let gscall = let gscall =
args.path_to_ghostscript ^ Filename.quote_command args.path_to_ghostscript
" -dNOPAUSE " ^ (if args.gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ Filename.quote fo ^ ((if args.gs_quiet then ["-dQUIET"] else []) @
" -dBATCH " ^ Filename.quote fi ["-dNOPAUSE"; "-sDEVICE=pdfwrite"; "-sOUTPUTFILE=" ^ fo; "-dBATCH"; fi])
in in
match Sys.command gscall with match Sys.command gscall with
| 0 -> exit 0 | 0 -> exit 0

View File

@ -9,9 +9,13 @@ let embed_missing_fonts path_to_ghostscript gs_quiet fi fo =
exit 2 exit 2
end; end;
let gscall = let gscall =
path_to_ghostscript ^ Filename.quote_command path_to_ghostscript
" -dNOPAUSE " ^ (if gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ Filename.quote fo ^ ((if gs_quiet then ["-dQUIET"] else []) @
" -dBATCH " ^ Filename.quote fi ["-dNOPAUSE";
"-sDEVICE=pdfwrite";
("-sOUTPUTFILE=" ^ fo);
"-dBATCH";
fi])
in in
match Sys.command gscall with match Sys.command gscall with
| 0 -> exit 0 | 0 -> exit 0