From c4b95c1eb640ac6d73531eb541b2674a58c6ee3c Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 11 Sep 2024 17:16:49 +0100 Subject: [PATCH] Create PDF/UA-2 --- cpdfcommand.ml | 6 +++++- cpdfua.ml | 11 +++++++++++ cpdfua.mli | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 3992981..5682eb1 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2627,7 +2627,10 @@ let specs = " Create a new PDF"); ("-create-pdf-ua-1", Arg.String (fun _ -> ()), (* Processed elsewhere *) - " Create a new PDF/UA-1 with the new title"); + " Create a new PDF/UA-1 with the given title"); + ("-create-pdf-ua-2", + Arg.String (fun _ -> ()), (* Processed elsewhere *) + " Create a new PDF/UA-2 with the given title"); ("-create-pdf-pages", Arg.Int setcreatepdfpages, " Number of pages for new PDF"); @@ -4621,6 +4624,7 @@ let expand_args argv = let rec expand_recipes = function | [] -> [] | "-create-pdf-ua-1"::title::t -> Cpdfua.cpdfua_args title @ expand_recipes t + | "-create-pdf-ua-2"::title::t -> Cpdfua.cpdfua2_args title @ expand_recipes t | h::t -> h::expand_recipes t let expand_recipes argv = diff --git a/cpdfua.ml b/cpdfua.ml index a75cbfc..1ace6ae 100644 --- a/cpdfua.ml +++ b/cpdfua.ml @@ -1595,3 +1595,14 @@ let cpdfua_args title = "AND"; "-replace-obj"; "/Root/StructTreeRoot/Type={\"N\":\"/StructTreeRoot\"}"; "AND"; "-set-version"; "7"; "AND"; "-mark-as"; "PDF/UA-1"] + +let cpdfua2_args title = + [ "-create-pdf"; + "AND"; "-set-title"; title; + "AND"; "-create-metadata"; + "AND"; "-set-language"; "en-US"; + "AND"; "-display-doc-title"; "true"; + "AND"; "-replace-obj"; "/Root/MarkInfo/Marked=true"; + "AND"; "-replace-obj"; "/Root/StructTreeRoot/Type={\"N\":\"/StructTreeRoot\"}"; + "AND"; "-set-version"; "10"; + "AND"; "-mark-as"; "PDF/UA-2"] diff --git a/cpdfua.mli b/cpdfua.mli index 7fb62bf..f8976e4 100644 --- a/cpdfua.mli +++ b/cpdfua.mli @@ -26,3 +26,4 @@ val replace_struct_tree : Pdf.t -> Cpdfyojson.Safe.t -> unit (** / **) val cpdfua_args : string -> string list +val cpdfua2_args : string -> string list