This commit is contained in:
John Whitington 2022-01-13 13:43:23 +00:00
parent 18a04c835d
commit c21fd91eee
4 changed files with 34 additions and 3 deletions

View File

@ -1 +1,4 @@
(** Debugging tools *)
(** Print all the objects from a given PDF to Standard Output. *)
val print_pdf_objs : Pdf.t -> unit val print_pdf_objs : Pdf.t -> unit

View File

@ -1,3 +1,10 @@
(** Error handling *)
(** Soft error in CPDF. *)
exception SoftError of string exception SoftError of string
val error : string -> 'a
(** Hard error in CPDF *)
exception HardError of string exception HardError of string
(** Raise SoftError with the given string. *)
val error : string -> 'a

View File

@ -1,4 +1,19 @@
val json_of_object : ?clean_strings:bool -> Pdf.t -> (int -> unit) -> bool -> bool -> Pdf.pdfobject -> Cpdfyojson.Safe.t (** Read and write PDFs in CPDFJSON format *)
val object_of_json : Cpdfyojson.Safe.t -> Pdf.pdfobject
(** 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. *)
val to_output : Pdfio.output -> parse_content:bool -> no_stream_data:bool -> decompress_streams:bool -> ?clean_strings:bool -> Pdf.t -> unit val to_output : Pdfio.output -> 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 val of_input : Pdfio.input -> Pdf.t
(** Convert a single PDF object to CPDFJSON format. [clean_strings] is 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. *)
val json_of_object : ?clean_strings:bool -> Pdf.t -> (int -> unit) -> bool -> bool -> Pdf.pdfobject -> Cpdfyojson.Safe.t
(** Convert a single CPDFJSON object to a PDF object *)
val object_of_json : Cpdfyojson.Safe.t -> Pdf.pdfobject

View File

@ -1,5 +1,9 @@
(** UnicodeData.txt in parsed form *)
(** The source, compressed. *)
val unicodedata_source : string val unicodedata_source : string
(** The type of a single entry from UnicodeData.txt *)
type t = type t =
{code_value : string; {code_value : string;
character_name : string; character_name : string;
@ -17,4 +21,6 @@ type t =
lowercase_mapping : string; lowercase_mapping : string;
titlecase_mapping : string} titlecase_mapping : string}
(** The unicode data. We pass a unit because it is parsed upon demand and
memoised. *)
val unicodedata : unit -> t list val unicodedata : unit -> t list