Update to use new subformat type

This commit is contained in:
John Whitington 2024-09-14 14:43:55 +01:00
parent b86fec486e
commit 93a28695d1
1 changed files with 7 additions and 9 deletions

View File

@ -221,8 +221,8 @@ type op =
| PrintObj of string | PrintObj of string
| ReplaceObj of string * string | ReplaceObj of string * string
| Verify of string | Verify of string
| MarkAs of string | MarkAs of Cpdfua.subformat
| RemoveMark of string | RemoveMark of Cpdfua.subformat
| PrintStructTree | PrintStructTree
| ExtractStructTree | ExtractStructTree
| ReplaceStructTree of string | ReplaceStructTree of string
@ -2864,8 +2864,8 @@ let specs =
("-json", Arg.Unit (fun () -> args.format_json <- true), " Format output as JSON"); ("-json", Arg.Unit (fun () -> args.format_json <- true), " Format output as JSON");
("-verify", Arg.String (fun s -> setop (Verify s) ()), " Verify conformance to a standard"); ("-verify", Arg.String (fun s -> setop (Verify s) ()), " Verify conformance to a standard");
("-verify-single", Arg.String (fun s -> args.verify_single <- Some s), " Verify a single test"); ("-verify-single", Arg.String (fun s -> args.verify_single <- Some s), " Verify a single test");
("-mark-as", Arg.String (fun s -> setop (MarkAs s) ()), " Mark as conforming to a standard"); ("-mark-as", Arg.String (fun s -> setop (MarkAs (Cpdfua.subformat_of_string s)) ()), " Mark as conforming to a standard");
("-remove-mark", Arg.String (fun s -> setop (RemoveMark s) ()), " Remove conformance mark"); ("-remove-mark", Arg.String (fun s -> setop (RemoveMark (Cpdfua.subformat_of_string s)) ()), " Remove conformance mark");
("-print-struct-tree", Arg.Unit (fun () -> setop PrintStructTree ()), " Print structure tree"); ("-print-struct-tree", Arg.Unit (fun () -> setop PrintStructTree ()), " Print structure tree");
("-extract-struct-tree", Arg.Unit (fun () -> setop ExtractStructTree ()), " Extract structure tree in JSON format"); ("-extract-struct-tree", Arg.Unit (fun () -> setop ExtractStructTree ()), " Extract structure tree in JSON format");
("-replace-struct-tree", Arg.String (fun s -> setop (ReplaceStructTree s) ()), " Replace structure tree from JSON"); ("-replace-struct-tree", Arg.String (fun s -> setop (ReplaceStructTree s) ()), " Replace structure tree from JSON");
@ -4566,23 +4566,21 @@ let go () =
end end
| Some (MarkAs standard) -> | Some (MarkAs standard) ->
begin match standard with begin match standard with
| "PDF/UA-1" -> | Cpdfua.PDFUA1 ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
Cpdfua.mark pdf; Cpdfua.mark pdf;
write_pdf false pdf write_pdf false pdf
| "PDF/UA-2" -> | Cpdfua.PDFUA2 ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
Cpdfua.mark2 2024 pdf; Cpdfua.mark2 2024 pdf;
write_pdf false pdf write_pdf false pdf
| _ -> error "Unknown standard"
end end
| Some (RemoveMark standard) -> | Some (RemoveMark standard) ->
begin match standard with begin match standard with
| "PDF/UA-1" | "PDF/UA-2" -> | Cpdfua.PDFUA1 | Cpdfua.PDFUA2 ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
Cpdfua.remove_mark pdf; Cpdfua.remove_mark pdf;
write_pdf false pdf write_pdf false pdf
| _ -> error "Unknown standard"
end end
| Some PrintStructTree -> | Some PrintStructTree ->
let pdf = get_single_pdf args.op true in let pdf = get_single_pdf args.op true in