diff --git a/cpdfaddtext.mli b/cpdfaddtext.mli index 5b8e744..8e94e51 100644 --- a/cpdfaddtext.mli +++ b/cpdfaddtext.mli @@ -45,6 +45,19 @@ 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 -> + bool -> + float -> + float -> + Cpdfposition.position -> + bool -> bool -> int list -> Pdf.t -> Pdf.t + +(**/**) val replace_pairs : Pdf.t -> int -> @@ -56,13 +69,3 @@ val replace_pairs : val process_text : Cpdfstrftime.t -> string -> (string * (unit -> string)) list -> string -(* Add a rectangle to the page *) -val addrectangle : - bool -> - float * float -> - color -> - bool -> - float -> - float -> - Cpdfposition.position -> - bool -> bool -> int list -> Pdf.t -> Pdf.t diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 21df03c..fffcab2 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -4483,7 +4483,7 @@ let go () = let ops = match !drawops with [("_MAIN", ops)] -> rev ops | _ -> error "not enough -end-xobj or -et" in write_pdf false - (Cpdfdraw.draw ~fast:args.fast ~filename:args.original_filename ~bates:args.bates ~batespad:args.batespad args.fast range pdf ops) + (Cpdfdraw.draw ~fast:args.fast ~underneath:args.underneath ~filename:args.original_filename ~bates:args.bates ~batespad:args.batespad range pdf ops) | Some (Composition json) -> let pdf = get_single_pdf args.op false in let filesize = diff --git a/cpdfdraw.ml b/cpdfdraw.ml index 33224c0..2e10c2f 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -420,7 +420,7 @@ let draw_single ~fast ~underneath ~filename ~bates ~batespad fast range pdf draw in Pdfpage.change_pages true pdf pages -let draw ?(fast=false) ?(underneath=false) ~filename ~bates ~batespad fast range pdf drawops = +let draw ?(fast=false) ?(underneath=false) ~filename ~bates ~batespad range pdf drawops = (*Printf.printf "%s\n" (string_of_drawops drawops); *) resstack := [empty_res ()]; Hashtbl.clear !fontpacks; diff --git a/cpdfdraw.mli b/cpdfdraw.mli index 06eaf55..aaf0757 100644 --- a/cpdfdraw.mli +++ b/cpdfdraw.mli @@ -1,3 +1,5 @@ +(** Draw on PDFs *) + type colspec = NoCol | RGB of float * float * float @@ -48,9 +50,11 @@ type drawops = | RenderMode of int | Rise of float +(** Calling [draw fast underneath filename bates batespad range pdf drawops] draws on + top of all the pages in the range. *) val draw : ?fast:bool -> ?underneath:bool -> filename:string -> bates:int -> batespad:int option -> - bool -> int list -> Pdf.t -> drawops list -> Pdf.t + int list -> Pdf.t -> drawops list -> Pdf.t diff --git a/cpdfjson.mli b/cpdfjson.mli index 419feca..7ef043d 100644 --- a/cpdfjson.mli +++ b/cpdfjson.mli @@ -3,13 +3,14 @@ (** Write a PDF in CPDFJSON format. [parse_content] parses page content streams, [no_stream_data] will omit stream data, [decompress_streams] decompresses all streams, [clean_strings] will convert any UTF16BE strings - to PDFDocEncoding if it can. *) + to PDFDocEncoding if it can. If [utf8] is set, CPDFJSON UTF8 format is used + instead. *) val to_output : Pdfio.output -> utf8:bool -> parse_content:bool -> no_stream_data:bool -> decompress_streams:bool -> ?clean_strings:bool -> Pdf.t -> unit (** Read a CPDFJSON PDF from an input. /Length entries will be corrected automatically. *) val of_input : Pdfio.input -> Pdf.t -(** Convert a single PDF object to CPDFJSON format. [clean_strings] is as above. +(** Convert a single PDF object to CPDFJSON format. [clean_strings] and [utf8] are as above. Then the PDF file, then a function which is usually [function _ -> ()], then [no_stream_data] as above, then [parse_content_streams] as above, and finally the object itself. *) diff --git a/cpdfpagespec.mli b/cpdfpagespec.mli index 1a68feb..c3d92fb 100644 --- a/cpdfpagespec.mli +++ b/cpdfpagespec.mli @@ -4,6 +4,7 @@ {ul {- Page numbers can be given plain, like 1 or 2, or as page labels, like <1> or (backslash to escape intended angle bracket)} +{- A page label may be used in place of a number e.g [[iii]] represents the first page found which is labelled [iii]. } {- A dash (-) defines ranges e.g 1-5 or 6-3.} {- A comma (,) allows one to specify several ranges, e.g. 1-2,4-5.} {- The word end represents the last page number.} diff --git a/cpdftype.mli b/cpdftype.mli index 89a9173..069a130 100644 --- a/cpdftype.mli +++ b/cpdftype.mli @@ -12,10 +12,14 @@ type element = type t = element list +(** Debug printing *) val to_string : t -> string +(** Return the font width table for a given (id, font, fontsize) combination. *) val font_widths : string -> Pdftext.font -> float -> float array +(** Calculate the widths of a string given a font width table, and list of char codes *) val width_of_string : float array -> char list -> float +(** [typeset lmargin rmargin tmargin bmargin papersize pdf contents] builds a list of pages of typset content. *) val typeset : float -> float -> float -> float -> Pdfpaper.t -> Pdf.t -> t -> Pdfpage.t list