diff --git a/cpdfaddtext.ml b/cpdfaddtext.ml index 80848de..d0fdf38 100644 --- a/cpdfaddtext.ml +++ b/cpdfaddtext.ml @@ -2,7 +2,7 @@ open Pdfutil open Cpdferror -type color = +type colour = Grey of float | RGB of float * float * float | CYMK of float * float * float * float diff --git a/cpdfaddtext.mli b/cpdfaddtext.mli index 8e94e51..5388529 100644 --- a/cpdfaddtext.mli +++ b/cpdfaddtext.mli @@ -1,13 +1,16 @@ (** Adding text *) -type color = +(** Colours *) +type colour = Grey of float | RGB of float * float * float | CYMK of float * float * float * float -val colour_op : color -> Pdfops.t +(** Build a colour operation for filling with the given colour. *) +val colour_op : colour -> Pdfops.t -val colour_op_stroke : color -> Pdfops.t +(** Build a colour operation for filing with the given colour *) +val colour_op_stroke : colour -> Pdfops.t (** Justification of multiline text *) type justification = @@ -26,7 +29,7 @@ val addtexts : Cpdfembed.cpdffont -> (*font*) int -> (* bates number *) int option -> (* bates padding width *) - color -> (*colour*) + colour -> (*colour*) Cpdfposition.position -> (*position*) float -> (*linespacing*) float -> (*fontsize*) @@ -45,12 +48,11 @@ val addtexts : Pdf.t ->(*pdf*) Pdf.t - (** Add a rectangle to the given pages. [addrectangle fast (w, h) colour outline linewidth opacity position relative_to_cropbox underneath range pdf]. *) val addrectangle : bool -> float * float -> - color -> + colour -> bool -> float -> float -> diff --git a/cpdfchop.mli b/cpdfchop.mli index 5154650..a01ef29 100644 --- a/cpdfchop.mli +++ b/cpdfchop.mli @@ -1,6 +1,7 @@ (** Chop *) -(** Chop a page into pieces. *) +(** Chop pages in the given range into pieces. *) val chop : x:int -> y:int -> columns:bool -> btt:bool -> rtl:bool -> Pdf.t -> int list -> Pdf.t +(** Chop a page in the given range horizontally or vertically. *) val chop_hv : is_h:bool -> line:float -> columns:bool -> Pdf.t -> int list -> Pdf.t diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 07b96b9..5797654 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -430,7 +430,7 @@ type args = mutable fontencoding : Pdftext.encoding; mutable fontsize : float; mutable embedstd14 : string option; - mutable color : Cpdfaddtext.color; + mutable color : Cpdfaddtext.colour; mutable opacity : float; mutable position : Cpdfposition.position; mutable underneath : bool; @@ -1201,7 +1201,7 @@ let setaddtext s = setop (AddText s) () let setcolor s = - args.color <- Cpdfdrawcontrol.parse_color s + args.color <- Cpdfdrawcontrol.parse_colour s let setopacity o = args.opacity <- o diff --git a/cpdfcomposition.mli b/cpdfcomposition.mli index 4dcd6c8..a8496fd 100644 --- a/cpdfcomposition.mli +++ b/cpdfcomposition.mli @@ -1,7 +1,9 @@ (** Show composition of a PDF *) (** [show_composition filesize json pdf] prints the composition of a document to - Standard Output. *) +Standard Output. *) val show_composition : int -> bool -> Pdf.t -> unit +(** [show_composition_json_blob filesize json pdf] returns the composition of a +document in JSON format. *) val show_composition_json_blob : int -> Pdf.t -> Pdfio.bytes diff --git a/cpdfdrawcontrol.ml b/cpdfdrawcontrol.ml index e13c965..9eba079 100644 --- a/cpdfdrawcontrol.ml +++ b/cpdfdrawcontrol.ml @@ -63,7 +63,7 @@ let pop () = let readfloats s = map float_of_string (String.split_on_char ' ' s) -let parse_color s = +let parse_colour s = match lookup (String.lowercase_ascii s) Cpdfcolours.colours with | Some c -> let r = float_of_int ((c land 0xFF0000) lsr 16) /. 255. in @@ -83,7 +83,7 @@ let parse_color s = | _ -> error "Bad color" let col_of_string s = - match parse_color s with + match parse_colour s with | Cpdfaddtext.RGB (r, g, b) -> Cpdfdraw.RGB (r, g, b) | Cpdfaddtext.Grey g -> Cpdfdraw.Grey g | Cpdfaddtext.CYMK (c, y, m, k) -> Cpdfdraw.CYMK (c, y, m, k) diff --git a/cpdfdrawcontrol.mli b/cpdfdrawcontrol.mli index 2ead90b..f918733 100644 --- a/cpdfdrawcontrol.mli +++ b/cpdfdrawcontrol.mli @@ -1,3 +1,5 @@ +(** Cpdfcommand draw control *) + val embed_font : (unit -> Cpdfembed.cpdffont) ref val getfontname : (unit -> string) ref val getfontsize : (unit -> float) ref @@ -11,7 +13,7 @@ val loadttfseparate : string -> string -> unit val fontpack_initialised : bool ref val drawops : (string * Cpdfdraw.drawops list) list ref val addop : Cpdfdraw.drawops -> unit -val parse_color : string -> Cpdfaddtext.color +val parse_colour : string -> Cpdfaddtext.colour val addrect : string -> unit val addto : string -> unit val addline : string -> unit @@ -64,3 +66,6 @@ val addnewline : unit -> unit val add_default_fontpack : string -> unit val addtext : string -> unit val addspecialtext : string -> unit + +(** This the beginnings of separation between cpdfcommand and cpdfdraw when + drawing, for use in cpdflib. It is presently undocumented. *) diff --git a/cpdfimage.mli b/cpdfimage.mli index 85b32a6..66fcb14 100644 --- a/cpdfimage.mli +++ b/cpdfimage.mli @@ -11,6 +11,7 @@ val extract_images : (** Report image resolutions. *) val image_resolution : Pdf.t -> int list -> float -> (int * string * int * int * float * float * int) list +(** Report image resolution data in JSON format *) val image_resolution_json : Pdf.t -> int list -> float -> Pdfio.bytes (** List images in JSON format *) diff --git a/cpdfmetadata.mli b/cpdfmetadata.mli index 5d4c6a1..314e68e 100644 --- a/cpdfmetadata.mli +++ b/cpdfmetadata.mli @@ -80,7 +80,7 @@ val set_metadata_date : Pdf.t -> string -> Pdf.t (** Expands the date ["now"] to the date now. Leaves any other string alone. *) val expand_date : string -> string -(** / **) +(**/**) val get_catalog_item : string -> Pdf.t -> string val get_viewer_pref_item : string -> Pdf.t -> string diff --git a/cpdfpage.mli b/cpdfpage.mli index cdc9e47..c9917d9 100644 --- a/cpdfpage.mli +++ b/cpdfpage.mli @@ -25,6 +25,8 @@ val hard_box : Pdf.t -> int list -> string -> bool -> bool -> Pdf.t for all pages in pdf. *) val shift_pdf : ?fast:bool -> (float * float) list -> Pdf.t -> int list -> Pdf.t +(** Shift a PDF's boxes in x and y (in pts) in the given pages. List of (x, y) +pairs is for all pages in pdf. *) val shift_boxes : (float * float) list -> Pdf.t -> int list -> Pdf.t (** Change a page's media box so its minimum x and y are 0, making other diff --git a/cpdftweak.mli b/cpdftweak.mli index bd32c0d..6db705b 100644 --- a/cpdftweak.mli +++ b/cpdftweak.mli @@ -4,13 +4,13 @@ val thinlines : int list -> float -> Pdf.t -> Pdf.t (** Make all text on certain pages black. *) -val blacktext : Cpdfaddtext.color -> int list -> Pdf.t -> Pdf.t +val blacktext : Cpdfaddtext.colour -> int list -> Pdf.t -> Pdf.t (** Make all lines on certain pages black. *) -val blacklines : Cpdfaddtext.color -> int list -> Pdf.t -> Pdf.t +val blacklines : Cpdfaddtext.colour -> int list -> Pdf.t -> Pdf.t (** Make all fills on certain pages black. *) -val blackfills : Cpdfaddtext.color -> int list -> Pdf.t -> Pdf.t +val blackfills : Cpdfaddtext.colour -> int list -> Pdf.t -> Pdf.t (** Append page content. *) val append_page_content : string -> bool -> bool -> int list -> Pdf.t -> Pdf.t