This commit is contained in:
John Whitington 2022-01-13 16:18:54 +00:00
parent 2340174a91
commit 9e58ad6613
10 changed files with 37 additions and 10 deletions

View File

@ -1,4 +1,4 @@
(** {2 Annotations} *) (** Annotations *)
(** List the annotations to standard output in a given encoding. See cpdfmanual.pdf for the format details. *) (** List the annotations to standard output in a given encoding. See cpdfmanual.pdf for the format details. *)
val list_annotations : json:bool -> Cpdfmetadata.encoding -> Pdf.t -> unit val list_annotations : json:bool -> Cpdfmetadata.encoding -> Pdf.t -> unit

View File

@ -3,7 +3,7 @@ let demo = false
let noncomp = false let noncomp = false
let major_version = 2 let major_version = 2
let minor_version = 5 let minor_version = 5
let version_date = "(9th Jan 2022)" let version_date = "(14th Jan 2022)"
open Pdfutil open Pdfutil
open Pdfio open Pdfio

View File

@ -1,12 +1,13 @@
(** {2 Imposition} *) (** Imposition *)
(** Imposition. See cpdfmanual.pdf for details. *)
val impose : x:float -> y:float -> fit:bool -> columns:bool -> rtl:bool -> btt:bool -> center:bool -> margin:float -> spacing:float -> linewidth:float -> fast:bool -> Pdf.t -> Pdf.t val impose : x:float -> y:float -> fit:bool -> columns:bool -> rtl:bool -> btt:bool -> center:bool -> margin:float -> spacing:float -> linewidth:float -> fast:bool -> Pdf.t -> Pdf.t
(** The twoup_stack operation puts two logical pages on each physical page, (** The legacy twoup_stack operation puts two logical pages on each physical page,
rotating them 90 degrees to do so. The new mediabox is thus larger. Bool true rotating them 90 degrees to do so. The new mediabox is thus larger. Bool true
(fast) if assume well-formed ISO content streams. *) (fast) if assume well-formed ISO content streams. *)
val twoup_stack : bool -> Pdf.t -> Pdf.t val twoup_stack : bool -> Pdf.t -> Pdf.t
(** The twoup operation does the same, but scales the new sides down so that (** The legacy twoup operation does the same, but scales the new sides down so that
the media box is unchanged. Bool true (fast) if assume well-formed ISO content streams. *) the media box is unchanged. Bool true (fast) if assume well-formed ISO content streams. *)
val twoup : bool -> Pdf.t -> Pdf.t val twoup : bool -> Pdf.t -> Pdf.t

View File

@ -1,9 +1,16 @@
val ocg_coalesce : Pdf.t -> unit (** Optional content groups *)
(** Return list of OCG names. *)
val ocg_get_list : Pdf.t -> string list val ocg_get_list : Pdf.t -> string list
(** Print OCG list to Standard Output. *)
val ocg_list : Pdf.t -> unit val ocg_list : Pdf.t -> unit
(** Coalesce same-named OCGs resulting from merge. *)
val ocg_coalesce : Pdf.t -> unit
(** Rename an OCG. *)
val ocg_rename : string -> string -> Pdf.t -> unit val ocg_rename : string -> string -> Pdf.t -> unit
(** Make sure every OCG is in the /Order. *)
val ocg_order_all : Pdf.t -> unit val ocg_order_all : Pdf.t -> unit

View File

@ -1,4 +1,4 @@
(** {2 Padding} *) (** Padding *)
(** Put blank pages before the given page numbers *) (** Put blank pages before the given page numbers *)
val padbefore : ?padwith:Pdf.t -> int list -> Pdf.t -> Pdf.t val padbefore : ?padwith:Pdf.t -> int list -> Pdf.t -> Pdf.t

View File

@ -1,4 +1,4 @@
(** {2 Working with pages} *) (** Working with pages *)
(** Print page info (Mediabox etc) to standard output. *) (** Print page info (Mediabox etc) to standard output. *)
val output_page_info : Pdf.t -> int list -> unit val output_page_info : Pdf.t -> int list -> unit
@ -14,14 +14,22 @@ val iter_pages : (int -> Pdfpage.t -> unit) -> Pdf.t -> int list -> unit
(** Same as [process_pages] but return the list of outputs of the map function. *) (** Same as [process_pages] but return the list of outputs of the map function. *)
val map_pages : (int -> Pdfpage.t -> 'a) -> Pdf.t -> int list -> 'a list val map_pages : (int -> Pdfpage.t -> 'a) -> Pdf.t -> int list -> 'a list
(** Clip a page to one of its boxes, or the media box if that box is not
present. This is a hard clip, done by using a clipping rectangle, so that the
page may then be used as a stamp without extraneous material reapearing. *)
val hard_box : Pdf.t -> int list -> string -> bool -> bool -> Pdf.t val hard_box : Pdf.t -> int list -> string -> bool -> bool -> Pdf.t
(** Shift a PDF in x and y (in pts) in the given pages. List of (x, y) pairs is (** Shift a PDF in x and y (in pts) in the given pages. List of (x, y) pairs is
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
(** Change a page's media box so its minimum x and y are 0, making other
operations simpler to think about. Any shift that is done is reflected in
other boxes (clip etc.) *)
val rectify_boxes : ?fast:bool -> Pdf.t -> Pdfpage.t -> Pdfpage.t val rectify_boxes : ?fast:bool -> Pdf.t -> Pdfpage.t -> Pdfpage.t
(** Change the media box and other known boxes by a function which takes
xmin, xmax, ymin, ymax as input. *)
val change_boxes : (float * float * float * float -> float * float * float * float) -> val change_boxes : (float * float * float * float -> float * float * float * float) ->
Pdf.t -> Pdfpage.t -> Pdfpage.t Pdf.t -> Pdfpage.t -> Pdfpage.t
@ -98,10 +106,14 @@ val vflip_pdf : ?fast:bool -> Pdf.t -> int list -> Pdf.t
(** Flip the given pages horizontally *) (** Flip the given pages horizontally *)
val hflip_pdf : ?fast:bool -> Pdf.t -> int list -> Pdf.t val hflip_pdf : ?fast:bool -> Pdf.t -> int list -> Pdf.t
(** Add trim marks. *)
val trim_marks : ?fast:bool -> Pdf.t -> int list -> Pdf.t val trim_marks : ?fast:bool -> Pdf.t -> int list -> Pdf.t
(** Show the page boxes for debug. *)
val show_boxes : ?fast:bool -> Pdf.t -> int list -> Pdf.t val show_boxes : ?fast:bool -> Pdf.t -> int list -> Pdf.t
(** Copy one box to another in the given pages. *)
val copy_box : string -> string -> bool -> Pdf.t -> int list -> Pdf.t val copy_box : string -> string -> bool -> Pdf.t -> int list -> Pdf.t
(** True if all pages are "upright" i.e no rotation and (0,0)-based. *)
val allupright : int list -> Pdf.t -> bool val allupright : int list -> Pdf.t -> bool

View File

@ -1,6 +1,5 @@
(** {2 Page labels} *) (** Page labels *)
(** Add page labels. *) (** Add page labels. *)
val add_page_labels : val add_page_labels :
Pdf.t -> bool -> Pdfpagelabels.labelstyle -> string option -> int -> int list -> unit Pdf.t -> bool -> Pdfpagelabels.labelstyle -> string option -> int -> int list -> unit

View File

@ -1 +1,4 @@
(** Spot colours *)
(** List spot colours to Standard Output. *)
val list_spot_colours : Pdf.t -> unit val list_spot_colours : Pdf.t -> unit

View File

@ -1,3 +1,5 @@
(** Lossless compression *)
(** Compresses all streams in the PDF document which are uncompressed, using (** Compresses all streams in the PDF document which are uncompressed, using
/FlateDecode, leaving out metadata. If the PDF is encrypted, does nothing. *) /FlateDecode, leaving out metadata. If the PDF is encrypted, does nothing. *)
val recompress_pdf : Pdf.t -> Pdf.t val recompress_pdf : Pdf.t -> Pdf.t

View File

@ -1 +1,4 @@
(** Table of contents *)
(** Typeset a table of contents and prepend to the document. *)
val typeset_table_of_contents : font:Pdftext.standard_font -> fontsize:float -> title:string -> bookmark:bool -> Pdf.t -> Pdf.t val typeset_table_of_contents : font:Pdftext.standard_font -> fontsize:float -> title:string -> bookmark:bool -> Pdf.t -> Pdf.t