Outline for remove_struct_tree

This commit is contained in:
John Whitington
2025-03-10 13:36:45 +00:00
parent 502f51b671
commit 38e7573350
5 changed files with 16 additions and 1 deletions

View File

@@ -229,6 +229,7 @@ type op =
| PrintStructTree
| ExtractStructTree
| ReplaceStructTree of string
| RemoveStructTree
| SetLanguage of string
| Redact
| Rasterize
@@ -385,6 +386,7 @@ let string_of_op = function
| PrintStructTree -> "PrintStructTree"
| ExtractStructTree -> "ExtractStructTree"
| ReplaceStructTree _ -> "ReplaceStructTree"
| RemoveStructTree -> "RemoveStructTree"
| SetLanguage _ -> "SetLanguage"
| Redact -> "Redact"
| Rasterize -> "Rasterize"
@@ -959,7 +961,7 @@ let banned banlist = function
| OCGRename | OCGList | OCGOrderAll | PrintFontEncoding _ | TableOfContents | Typeset _ | Composition _
| TextWidth _ | SetAnnotations _ | CopyAnnotations _ | ExtractStream _ | ReplaceStream _ | PrintObj _ | ReplaceObj _
| Verify _ | MarkAs _ | RemoveMark _ | ExtractStructTree | ReplaceStructTree _ | SetLanguage _
| PrintStructTree | Rasterize | OutputImage
| PrintStructTree | Rasterize | OutputImage | RemoveStructTree
-> false (* Always allowed *)
(* Combine pages is not allowed because we would not know where to get the
-recrypt from -- the first or second file? *)
@@ -4891,6 +4893,10 @@ let go () =
let json = Cpdfyojson.Safe.from_file s in
Cpdfua.replace_struct_tree pdf json;
write_pdf false pdf
| Some RemoveStructTree ->
let pdf = get_single_pdf args.op false in
Cpdfua.remove_struct_tree pdf;
write_pdf false pdf
| Some (SetLanguage s) ->
let pdf = get_single_pdf args.op false in
Cpdfmetadata.set_language pdf s;