This commit is contained in:
John Whitington 2021-10-18 16:12:10 +01:00
parent c4768c9a92
commit 52dc0585c8
3 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# Build the cpdf command line tools and top level
MODS = cpdfyojson cpdfxmlm \
cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \
cpdfpagespec cpdfposition cpdf cpdfcommand
cpdfpagespec cpdfposition cpdffont cpdf cpdfcommand
SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml

14
cpdffont.ml Normal file
View File

@ -0,0 +1,14 @@
(* Embed missing fonts with Ghostscript. *)
let embed_missing_fonts path_to_ghostscript gs_quiet fi fo =
if path_to_ghostscript = "" then begin
Printf.eprintf "Please supply path to gs with -gs\n%!";
exit 2
end;
let gscall =
path_to_ghostscript ^
" -dNOPAUSE " ^ (if gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ Filename.quote fo ^
" -dBATCH " ^ Filename.quote fi
in
match Sys.command gscall with
| 0 -> exit 0
| _ -> Printf.eprintf "Font embedding failed.\n%!"; exit 2

1
cpdffont.mli Normal file
View File

@ -0,0 +1 @@
val embed_missing_fonts : string -> bool -> string -> string -> unit