From b86fec486ea4830a0ec9ad20dea2582955747416 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sat, 14 Sep 2024 14:40:53 +0100 Subject: [PATCH] Adds -typeset-subformat --- cpdfcommand.ml | 13 ++----------- cpdfua.ml | 9 +++++++++ cpdfua.mli | 6 ++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 4fec184..23e1139 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -77,15 +77,6 @@ let parse_pagespec_allow_empty pdf spec = try Cpdfpagespec.parse_pagespec pdf spec with Pdf.PDFError ("Page range specifies no pages") -> [] -type subformat = - | PDFUA1 - | PDFUA2 - -let subformat_of_string = function - | "PDF/UA-1" -> PDFUA1 - | "PDF/UA-2" -> PDFUA2 - | _ -> error "Unknown subformat" - (* Operations. *) type op = | CopyFont of string @@ -554,7 +545,7 @@ type args = mutable verify_single : string option; mutable draw_struct_tree : bool; mutable image_title : string option; - mutable subformat : subformat option} + mutable subformat : Cpdfua.subformat option} let args = {op = None; @@ -1710,7 +1701,7 @@ let settypeset s = setop (Typeset s) () let settypesetsubformat s = - args.subformat <- Some (subformat_of_string s) + args.subformat <- Some (Cpdfua.subformat_of_string s) let settableofcontentstitle s = args.toc_title <- s diff --git a/cpdfua.ml b/cpdfua.ml index 1ace6ae..5cdc3b5 100644 --- a/cpdfua.ml +++ b/cpdfua.ml @@ -37,6 +37,15 @@ open Cpdferror 30-002 31-007 31-008 31-011 31-012 31-013 31-014 31-015 31-016 31-018 31-030 *) +type subformat = + | PDFUA1 + | PDFUA2 + +let subformat_of_string = function + | "PDF/UA-1" -> PDFUA1 + | "PDF/UA-2" -> PDFUA2 + | _ -> error "Unknown subformat" + exception MatterhornError of Cpdfyojson.Safe.t exception MatterhornUnimplemented diff --git a/cpdfua.mli b/cpdfua.mli index f8976e4..623c094 100644 --- a/cpdfua.mli +++ b/cpdfua.mli @@ -1,5 +1,11 @@ (** PDF/UA *) +type subformat = + | PDFUA1 + | PDFUA2 + +val subformat_of_string : string -> subformat + (** Print matterhorn test results ("" = all tests) *) val test_matterhorn_print : Pdf.t -> string -> unit