This commit is contained in:
John Whitington 2021-12-19 13:26:15 +00:00
parent 349fd335f6
commit 0e9f35ab69
6 changed files with 20 additions and 19 deletions

View File

@ -2,7 +2,7 @@
MODS = cpdfyojson cpdfxmlm \ MODS = cpdfyojson cpdfxmlm \
cpdfunicodedata cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \ cpdfunicodedata cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \
cpdfpagespec cpdfposition cpdfpresent cpdfmetadata cpdf cpdffont cpdftype \ 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 SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml

15
cpdf.ml
View File

@ -3346,21 +3346,6 @@ let remove_unused_resources_page pdf n page =
let remove_unused_resources pdf = let remove_unused_resources pdf =
process_pages (ppstub (remove_unused_resources_page pdf)) pdf (ilist 1 (Pdfpage.endpage 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. *) (* 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 add_bookmark_title filename use_title pdf =
let title = let title =

View File

@ -299,8 +299,6 @@ val add_bookmark_title : string -> bool -> Pdf.t -> Pdf.t
val remove_unused_resources : 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 bookmarks_open_to_level : int -> Pdf.t -> Pdf.t
val create_pdf : int -> Pdfpaper.t -> Pdf.t val create_pdf : int -> Pdfpaper.t -> Pdf.t

View File

@ -3831,7 +3831,7 @@ let go () =
Cpdf.print_dict_entry pdf key Cpdf.print_dict_entry pdf key
| Some ListSpotColours -> | Some ListSpotColours ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
Cpdf.list_spot_colours pdf Cpdfspot.list_spot_colours pdf
| Some RemoveClipping -> | Some RemoveClipping ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in

17
cpdfspot.ml Normal file
View File

@ -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

1
cpdfspot.mli Normal file
View File

@ -0,0 +1 @@
val list_spot_colours : Pdf.t -> unit