cpdf-source/cpdfmetadata.mli

115 lines
3.9 KiB
OCaml
Raw Permalink Normal View History

2022-01-13 16:18:21 +01:00
(** Metadata *)
2021-12-19 13:55:06 +01:00
(** {2 Types and Exceptions} *)
(** Possible output encodings for some function. [Raw] does no processing at
all - the PDF string is output as-is. [UTF8] converts loslessly to UTF8.
[Stripped] extracts the unicode codepoints and returns only those which
correspond to 7 bit ASCII. *)
type encoding = Raw | UTF8 | Stripped
2022-01-13 16:18:21 +01:00
(** Encode a string using a given encoding. *)
2021-12-19 13:55:06 +01:00
val encode_output : encoding -> string -> string
(** {2 Metadata and settings} *)
(** [copy_id keepversion copyfrom copyto] copies the ID, if any, from
[copyfrom] to [copyto]. If [keepversion] is true, the PDF version of [copyto]
won't be affected. *)
val copy_id : bool -> Pdf.t -> Pdf.t -> Pdf.t
(** [set_pdf_info (key, value, version)] sets the entry [key] in the /Info directory, updating
the PDF minor version to [version].*)
val set_pdf_info : ?xmp_also:bool -> ?xmp_just_set:bool -> (string * Pdf.pdfobject * int) -> Pdf.t -> Pdf.t
2022-01-13 16:18:21 +01:00
(** Get XMP information for a given key. *)
2021-12-19 13:55:06 +01:00
val get_xmp_info : Pdf.t -> string -> string
(** [set_pdf_info (key, value, version)] sets the entry [key] in the
/ViewerPreferences directory, updating the PDF minor version to [version].*)
val set_viewer_preference : (string * Pdf.pdfobject * int) -> Pdf.t -> Pdf.t
(** Set the page layout to the given name (sans slash) e.g SinglePage *)
val set_page_layout : Pdf.t -> string -> Pdf.t
2023-04-17 20:55:11 +02:00
(** Set the page mode to the given name (sans slash) e.g UseThumbs *)
2021-12-19 13:55:06 +01:00
val set_page_mode : Pdf.t -> string -> Pdf.t
2023-04-17 20:55:11 +02:00
(** Set the non full screen page mode to the given name (sans slash) e.g UseThumbs *)
val set_non_full_screen_page_mode : Pdf.t -> string -> Pdf.t
2021-12-19 13:55:06 +01:00
(** Set the open action. If the boolean is true, /Fit will be used, otherwise /XYZ *)
2023-04-18 15:42:17 +02:00
val set_open_action : Pdf.t -> ?dest:string -> bool -> int -> Pdf.t
2021-12-19 13:55:06 +01:00
(** Set the PDF version number *)
val set_version : int -> Pdf.t -> unit
(** Given a PDF, returns a function which can lookup a given dictionary entry
from the /Info dictionary, returning it as a UTF8 string *)
val get_info_utf8 : Pdf.t -> string -> string
(** Output to standard output general information about a PDF. *)
2023-11-01 15:55:14 +01:00
val output_info : ?json:(string * Cpdfyojson.Safe.t) list ref -> encoding -> Pdf.t -> unit
2021-12-19 13:55:06 +01:00
(** Output to standard output information from any XMP metadata stream in a PDF. *)
2023-11-01 15:55:14 +01:00
val output_xmp_info : ?json:(string * Cpdfyojson.Safe.t) list ref -> encoding -> Pdf.t -> unit
2021-12-19 13:55:06 +01:00
(** Create XMP metadata from scratch *)
val create_metadata : Pdf.t -> Pdf.t
(** {2 XML Metadata} *)
(** [set_metadata keepversion filename pdf] sets the XML metadata of a PDF to the contents of [filename]. If [keepversion] is true, the PDF version will not be altered. *)
val set_metadata : bool -> string -> Pdf.t -> Pdf.t
(** The same, but the content comes from [bytes]. *)
val set_metadata_from_bytes : bool -> Pdfio.bytes -> Pdf.t -> Pdf.t
(** Remove the metadata from a file *)
val remove_metadata : Pdf.t -> Pdf.t
(** Extract metadata to a [Pdfio.bytes] *)
val get_metadata : Pdf.t -> Pdfio.bytes option
(** Print metadate to stdout *)
val print_metadata : Pdf.t -> unit
(** Set the metadata date *)
val set_metadata_date : Pdf.t -> string -> Pdf.t
2022-01-13 16:18:21 +01:00
(** Expands the date ["now"] to the date now. Leaves any other string alone. *)
2021-12-19 13:55:06 +01:00
val expand_date : string -> string
2023-08-31 15:52:24 +02:00
2024-03-04 16:16:14 +01:00
(**/**)
2023-08-31 15:52:24 +02:00
val get_catalog_item : string -> Pdf.t -> string
val get_viewer_pref_item : string -> Pdf.t -> string
2024-02-13 17:40:20 +01:00
val determine_subformats : Pdf.t -> string list
2024-05-31 17:08:27 +02:00
2024-06-12 17:15:33 +02:00
val language : Pdf.t -> string option
val set_language : Pdf.t -> string -> unit
2024-05-31 17:08:27 +02:00
val adobe : string
val xmp : string
val dc : string
val rdf : string
val pdfaid : string
val pdfxid : string
val pdfe : string
val pdfuaid : string
val pdfvtid : string
type xmltree =
E of Cpdfxmlm.tag * xmltree list
| D of string
val xmltree_of_bytes : Pdfio.bytes -> Cpdfxmlm.dtd * xmltree
val get_data_for : string -> string -> xmltree -> string option
2024-05-31 18:26:36 +02:00
val string_of_xmltree : xmltree -> string
val bytes_of_xmltree : Cpdfxmlm.dtd * xmltree -> Pdfio.bytes