module Cpdfpage:sig..end
Working with pages
val output_page_info : ?json:bool -> ?raisejson:bool -> Pdfunits.t -> Pdf.t -> int list -> unitPrint page info (Mediabox etc) to standard output.
val json_page_info : Pdf.t -> int list -> Pdfunits.t -> Cpdfyojson.Safe.tReturn page info for selected pages in JSON format.
val process_pages : (int -> Pdfpage.t -> Pdfpage.t * int * Pdftransform.transform_matrix) ->
Pdf.t -> int list -> Pdf.tGiven a function from page number and page to page, a document, and a list of page numbers to apply it to, apply the function to all those pages.
val iter_pages : (int -> Pdfpage.t -> unit) -> Pdf.t -> int list -> unitSame as process_pages, but iterate rather than map.
val map_pages : (int -> Pdfpage.t -> 'a) -> Pdf.t -> int list -> 'a listSame as process_pages but return the list of outputs of the map function.
val hard_box : Pdf.t -> int list -> string -> bool -> bool -> Pdf.tClip 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 shift_pdf : ?fast:bool -> (float * float) list -> Pdf.t -> int list -> Pdf.tShift a PDF 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.tShift 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 rectify_boxes : ?fast:bool -> Pdf.t -> Pdfpage.t -> Pdfpage.tChange 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 change_boxes : (float * float * float * float -> float * float * float * float) ->
Pdf.t -> Pdfpage.t -> Pdfpage.tChange the media box and other known boxes by a function which takes xmin, xmax, ymin, ymax as input.
val scale_contents : ?fast:bool -> Cpdfposition.position -> float -> Pdf.t -> int list -> Pdf.tScale the contents of a page by a given factor centred around a given point in a given range.
val set_mediabox : (float * float * float * float) list -> Pdf.t -> int list -> Pdf.tset_mediabox xywhlist pdf range sets the media box on the given pages.
val remove_cropping_pdf : Pdf.t -> int list -> Pdf.tRemove any cropping from the given pages.
val remove_trim_pdf : Pdf.t -> int list -> Pdf.tRemove any trim box from the given pages.
val remove_bleed_pdf : Pdf.t -> int list -> Pdf.tRemove any bleed box from the given pages.
val remove_art_pdf : Pdf.t -> int list -> Pdf.tRemove any art box from the given pages.
val upright : ?fast:bool -> int list -> Pdf.t -> Pdf.tModify the rotation of the page and its contents to leave the rotation at 0 with the page effectively unaltered.
val rotate_pdf : int -> Pdf.t -> int list -> Pdf.tChange rotation to a given value 0, 90, 180, 270 on given pages.
val rotate_pdf_by : int -> Pdf.t -> int list -> Pdf.tRotate clockwise by 0, 90, 180, 270 on given pages.
val rotate_contents : ?fast:bool -> float -> Pdf.t -> int list -> Pdf.tRotate the contents by the given angle on the given pages. If fast is true, assume PDF is well-formed.
val scale_pdf : ?fast:bool -> (float * float) list -> Pdf.t -> int list -> Pdf.tScale a PDF in sx, sy in the given pages. List of (sx, sy) pairs is for all pages in pdf.
val scale_to_fit_pdf : ?fast:bool ->
Cpdfposition.position ->
float -> (float * float) list -> 'a -> Pdf.t -> int list -> Pdf.tscale_to_fit_pdf fast position input_scale x y op pdf range scales a page to fit the
page size given by (x, y) and by the input_scale (e.g 1.0 = scale to fit, 0.9
= scale to fit leaving a border etc.). op is unused.
val stretch : ?fast:bool -> (float * float) list -> Pdf.t -> int list -> Pdf.tstretch fast pagesizes pdf range stretches content to fit the given page size without regard to aspect ratio.
val center_to_fit : (float * float) list -> Pdf.t -> int list -> Pdf.tcenter_to_fit : pagesizes pdf range moves content to the centre of the page without scaling it.
val combine_pages : process_struct_tree:bool -> bool -> Pdf.t -> Pdf.t -> bool -> bool -> Pdf.tcombine_pages fast under over scaletofit swap equalize combines the page
content of two PDFs, page-by-page. If equalize is true the output will have
the same number of pages as the shorter file. If scaletofit is true, the
over file will be scaled to fit. If swap is true, over and under are
swapped. If fast is true, the PDFs are assumed to be well-formed and no
fixes are done.
val stamp : process_struct_tree:bool ->
bool ->
Cpdfposition.position ->
bool -> bool -> bool -> bool -> bool -> int list -> Pdf.t -> Pdf.t -> Pdf.tstamp relative_to_cropbox position topline midline fast scale_to_fit isover range over pdf stamps the first page of
over over each page of the PDF. The arguments have the same meaning as in
combine_pages.
val hasbox : Pdf.t -> int -> string -> boolTrue if a given page in a PDF has a given box
val crop_pdf : ?box:string ->
(float * float * float * float) list -> Pdf.t -> int list -> Pdf.tcrop_pdf xywhlist pdf range sets the cropbox on the given pages.
val setBox : string -> float -> float -> float -> float -> Pdf.t -> int list -> Pdf.tsetBox boxname x y w h pdf range sets the given box on the given pages.
val vflip_pdf : ?fast:bool -> Pdf.t -> int list -> Pdf.tFlip the given pages vertically
val hflip_pdf : ?fast:bool -> Pdf.t -> int list -> Pdf.tFlip the given pages horizontally
val trim_marks : ?fast:bool -> Pdf.t -> int list -> Pdf.tAdd trim marks.
val show_boxes : ?fast:bool -> Pdf.t -> int list -> Pdf.tShow the page boxes for debug.
val copy_box : string -> string -> bool -> Pdf.t -> int list -> Pdf.tCopy one box to another in the given pages.
val allupright : int list -> Pdf.t -> boolTrue if all pages are "upright" i.e no rotation and (0,0)-based.
val alluprightonly : int list -> Pdf.t -> boolTrue if all pages are "upright" i.e no rotation.
val change_pattern_matrices_page : Pdf.t -> Pdftransform.transform_matrix -> Pdfpage.t -> Pdfpage.tWhen a page is transformed, its patterns must be too.
val redact : process_struct_tree:bool -> Pdf.t -> int list -> Pdf.tVery basic redaction - the removal of whole pages, optionally trimming the structure tree to remove any content there.
val remove_struct_tree : Pdf.t -> Pdf.tRemove a structure tree entirely from a file, including unmarking marked content.
val mark_all_as_artifact : Pdf.t -> Pdf.tMark a PDF as begin entirely artifacts (may be used after running remove_struct_tree.