From c21fd91eee07e5c40df692cf537c858ca19c6017 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 13 Jan 2022 13:43:23 +0000 Subject: [PATCH] more --- cpdfdebug.mli | 3 +++ cpdferror.mli | 9 ++++++++- cpdfjson.mli | 19 +++++++++++++++++-- cpdfunicodedata.mli | 6 ++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/cpdfdebug.mli b/cpdfdebug.mli index aa62ce3..a01caa6 100644 --- a/cpdfdebug.mli +++ b/cpdfdebug.mli @@ -1 +1,4 @@ +(** Debugging tools *) + +(** Print all the objects from a given PDF to Standard Output. *) val print_pdf_objs : Pdf.t -> unit diff --git a/cpdferror.mli b/cpdferror.mli index 3061dee..76b4cd7 100644 --- a/cpdferror.mli +++ b/cpdferror.mli @@ -1,3 +1,10 @@ +(** Error handling *) + +(** Soft error in CPDF. *) exception SoftError of string -val error : string -> 'a + +(** Hard error in CPDF *) exception HardError of string + +(** Raise SoftError with the given string. *) +val error : string -> 'a diff --git a/cpdfjson.mli b/cpdfjson.mli index 0675c6a..c77211f 100644 --- a/cpdfjson.mli +++ b/cpdfjson.mli @@ -1,4 +1,19 @@ -val json_of_object : ?clean_strings:bool -> Pdf.t -> (int -> unit) -> bool -> bool -> Pdf.pdfobject -> Cpdfyojson.Safe.t -val object_of_json : Cpdfyojson.Safe.t -> Pdf.pdfobject +(** Read and write PDFs in CPDFJSON format *) + +(** 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 + +(** 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. + 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 diff --git a/cpdfunicodedata.mli b/cpdfunicodedata.mli index 4b70009..d4d2638 100644 --- a/cpdfunicodedata.mli +++ b/cpdfunicodedata.mli @@ -1,5 +1,9 @@ +(** UnicodeData.txt in parsed form *) + +(** The source, compressed. *) val unicodedata_source : string +(** The type of a single entry from UnicodeData.txt *) type t = {code_value : string; character_name : string; @@ -17,4 +21,6 @@ type t = lowercase_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