From 0e9f35ab69b1e7fe60726d62dffc6d5b2514933e Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 19 Dec 2021 13:26:15 +0000 Subject: [PATCH] more --- Makefile | 2 +- cpdf.ml | 15 --------------- cpdf.mli | 2 -- cpdfcommand.ml | 2 +- cpdfspot.ml | 17 +++++++++++++++++ cpdfspot.mli | 1 + 6 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 cpdfspot.ml create mode 100644 cpdfspot.mli diff --git a/Makefile b/Makefile index 3d9ebbb..c33757f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MODS = cpdfyojson cpdfxmlm \ cpdfunicodedata cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \ cpdfpagespec cpdfposition cpdfpresent cpdfmetadata cpdf cpdffont cpdftype \ - cpdftexttopdf cpdftoc cpdfpad cpdfocg cpdfsqueeze cpdfcommand + cpdftexttopdf cpdftoc cpdfpad cpdfocg cpdfsqueeze cpdfspot cpdfcommand SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml diff --git a/cpdf.ml b/cpdf.ml index 53ea33c..4a2345c 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -3346,21 +3346,6 @@ let remove_unused_resources_page pdf n page = let remove_unused_resources pdf = process_pages (ppstub (remove_unused_resources_page pdf)) pdf (ilist 1 (Pdfpage.endpage pdf)) -let print_spot_colour n s = - Printf.printf "%i %s\n" n s - -let list_spot_colours pdf = - Pdf.objiter - (fun _ obj -> - match obj with - Pdf.Array (Pdf.Name "/Separation"::x::_) -> - begin match Pdf.direct pdf x with - Pdf.Name col -> Printf.printf "%s\n" col - | _ -> () - end - | _ -> ()) - pdf - (* Indent bookmarks in each file by one and add a title bookmark pointing to the first page. *) let add_bookmark_title filename use_title pdf = let title = diff --git a/cpdf.mli b/cpdf.mli index 5326cac..e65f73a 100644 --- a/cpdf.mli +++ b/cpdf.mli @@ -299,8 +299,6 @@ val add_bookmark_title : string -> bool -> Pdf.t -> Pdf.t val remove_unused_resources : Pdf.t -> Pdf.t -val list_spot_colours : Pdf.t -> unit - val bookmarks_open_to_level : int -> Pdf.t -> Pdf.t val create_pdf : int -> Pdfpaper.t -> Pdf.t diff --git a/cpdfcommand.ml b/cpdfcommand.ml index d1c5a90..e1ec797 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3831,7 +3831,7 @@ let go () = Cpdf.print_dict_entry pdf key | Some ListSpotColours -> let pdf = get_single_pdf args.op false in - Cpdf.list_spot_colours pdf + Cpdfspot.list_spot_colours pdf | Some RemoveClipping -> let pdf = get_single_pdf args.op false in let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in diff --git a/cpdfspot.ml b/cpdfspot.ml new file mode 100644 index 0000000..44d93a3 --- /dev/null +++ b/cpdfspot.ml @@ -0,0 +1,17 @@ +open Pdfutil + +let print_spot_colour n s = + Printf.printf "%i %s\n" n s + +let list_spot_colours pdf = + Pdf.objiter + (fun _ obj -> + match obj with + Pdf.Array (Pdf.Name "/Separation"::x::_) -> + begin match Pdf.direct pdf x with + Pdf.Name col -> Printf.printf "%s\n" col + | _ -> () + end + | _ -> ()) + pdf + diff --git a/cpdfspot.mli b/cpdfspot.mli new file mode 100644 index 0000000..2c11426 --- /dev/null +++ b/cpdfspot.mli @@ -0,0 +1 @@ +val list_spot_colours : Pdf.t -> unit