Docstring fixes for v2.7

This commit is contained in:
John Whitington 2024-03-04 15:16:14 +00:00
parent fcdec695c0
commit 1c8cbfb015
11 changed files with 31 additions and 18 deletions

View File

@ -2,7 +2,7 @@
open Pdfutil open Pdfutil
open Cpdferror open Cpdferror
type color = type colour =
Grey of float Grey of float
| RGB of float * float * float | RGB of float * float * float
| CYMK of float * float * float * float | CYMK of float * float * float * float

View File

@ -1,13 +1,16 @@
(** Adding text *) (** Adding text *)
type color = (** Colours *)
type colour =
Grey of float Grey of float
| RGB of float * float * float | RGB of float * float * float
| CYMK of float * 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 *) (** Justification of multiline text *)
type justification = type justification =
@ -26,7 +29,7 @@ val addtexts :
Cpdfembed.cpdffont -> (*font*) Cpdfembed.cpdffont -> (*font*)
int -> (* bates number *) int -> (* bates number *)
int option -> (* bates padding width *) int option -> (* bates padding width *)
color -> (*colour*) colour -> (*colour*)
Cpdfposition.position -> (*position*) Cpdfposition.position -> (*position*)
float -> (*linespacing*) float -> (*linespacing*)
float -> (*fontsize*) float -> (*fontsize*)
@ -45,12 +48,11 @@ val addtexts :
Pdf.t ->(*pdf*) Pdf.t ->(*pdf*)
Pdf.t Pdf.t
(** Add a rectangle to the given pages. [addrectangle fast (w, h) colour outline linewidth opacity position relative_to_cropbox underneath range pdf]. *) (** Add a rectangle to the given pages. [addrectangle fast (w, h) colour outline linewidth opacity position relative_to_cropbox underneath range pdf]. *)
val addrectangle : val addrectangle :
bool -> bool ->
float * float -> float * float ->
color -> colour ->
bool -> bool ->
float -> float ->
float -> float ->

View File

@ -1,6 +1,7 @@
(** Chop *) (** 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 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 val chop_hv : is_h:bool -> line:float -> columns:bool -> Pdf.t -> int list -> Pdf.t

View File

@ -430,7 +430,7 @@ type args =
mutable fontencoding : Pdftext.encoding; mutable fontencoding : Pdftext.encoding;
mutable fontsize : float; mutable fontsize : float;
mutable embedstd14 : string option; mutable embedstd14 : string option;
mutable color : Cpdfaddtext.color; mutable color : Cpdfaddtext.colour;
mutable opacity : float; mutable opacity : float;
mutable position : Cpdfposition.position; mutable position : Cpdfposition.position;
mutable underneath : bool; mutable underneath : bool;
@ -1201,7 +1201,7 @@ let setaddtext s =
setop (AddText s) () setop (AddText s) ()
let setcolor s = let setcolor s =
args.color <- Cpdfdrawcontrol.parse_color s args.color <- Cpdfdrawcontrol.parse_colour s
let setopacity o = let setopacity o =
args.opacity <- o args.opacity <- o

View File

@ -4,4 +4,6 @@
Standard Output. *) Standard Output. *)
val show_composition : int -> bool -> Pdf.t -> unit 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 val show_composition_json_blob : int -> Pdf.t -> Pdfio.bytes

View File

@ -63,7 +63,7 @@ let pop () =
let readfloats s = map float_of_string (String.split_on_char ' ' s) 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 match lookup (String.lowercase_ascii s) Cpdfcolours.colours with
| Some c -> | Some c ->
let r = float_of_int ((c land 0xFF0000) lsr 16) /. 255. in let r = float_of_int ((c land 0xFF0000) lsr 16) /. 255. in
@ -83,7 +83,7 @@ let parse_color s =
| _ -> error "Bad color" | _ -> error "Bad color"
let col_of_string s = 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.RGB (r, g, b) -> Cpdfdraw.RGB (r, g, b)
| Cpdfaddtext.Grey g -> Cpdfdraw.Grey g | Cpdfaddtext.Grey g -> Cpdfdraw.Grey g
| Cpdfaddtext.CYMK (c, y, m, k) -> Cpdfdraw.CYMK (c, y, m, k) | Cpdfaddtext.CYMK (c, y, m, k) -> Cpdfdraw.CYMK (c, y, m, k)

View File

@ -1,3 +1,5 @@
(** Cpdfcommand draw control *)
val embed_font : (unit -> Cpdfembed.cpdffont) ref val embed_font : (unit -> Cpdfembed.cpdffont) ref
val getfontname : (unit -> string) ref val getfontname : (unit -> string) ref
val getfontsize : (unit -> float) ref val getfontsize : (unit -> float) ref
@ -11,7 +13,7 @@ val loadttfseparate : string -> string -> unit
val fontpack_initialised : bool ref val fontpack_initialised : bool ref
val drawops : (string * Cpdfdraw.drawops list) list ref val drawops : (string * Cpdfdraw.drawops list) list ref
val addop : Cpdfdraw.drawops -> unit val addop : Cpdfdraw.drawops -> unit
val parse_color : string -> Cpdfaddtext.color val parse_colour : string -> Cpdfaddtext.colour
val addrect : string -> unit val addrect : string -> unit
val addto : string -> unit val addto : string -> unit
val addline : string -> unit val addline : string -> unit
@ -64,3 +66,6 @@ val addnewline : unit -> unit
val add_default_fontpack : string -> unit val add_default_fontpack : string -> unit
val addtext : string -> unit val addtext : string -> unit
val addspecialtext : 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. *)

View File

@ -11,6 +11,7 @@ val extract_images :
(** Report image resolutions. *) (** Report image resolutions. *)
val image_resolution : Pdf.t -> int list -> float -> (int * string * int * int * float * float * int) list 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 val image_resolution_json : Pdf.t -> int list -> float -> Pdfio.bytes
(** List images in JSON format *) (** List images in JSON format *)

View File

@ -25,6 +25,8 @@ val hard_box : Pdf.t -> int list -> string -> bool -> bool -> Pdf.t
for all pages in pdf. *) for all pages in pdf. *)
val shift_pdf : ?fast:bool -> (float * float) list -> Pdf.t -> int list -> Pdf.t 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 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 (** Change a page's media box so its minimum x and y are 0, making other

View File

@ -4,13 +4,13 @@
val thinlines : int list -> float -> Pdf.t -> Pdf.t val thinlines : int list -> float -> Pdf.t -> Pdf.t
(** Make all text on certain pages black. *) (** 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. *) (** 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. *) (** 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. *) (** Append page content. *)
val append_page_content : string -> bool -> bool -> int list -> Pdf.t -> Pdf.t val append_page_content : string -> bool -> bool -> int list -> Pdf.t -> Pdf.t