mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Outline for remove_struct_tree
This commit is contained in:
4
Changes
4
Changes
@ -1,5 +1,9 @@
|
|||||||
2.9 (to come)
|
2.9 (to come)
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
* -remove-struct-tree removes whole structure tree
|
||||||
|
|
||||||
Extended features:
|
Extended features:
|
||||||
|
|
||||||
o -obj JSON output
|
o -obj JSON output
|
||||||
|
@ -229,6 +229,7 @@ type op =
|
|||||||
| PrintStructTree
|
| PrintStructTree
|
||||||
| ExtractStructTree
|
| ExtractStructTree
|
||||||
| ReplaceStructTree of string
|
| ReplaceStructTree of string
|
||||||
|
| RemoveStructTree
|
||||||
| SetLanguage of string
|
| SetLanguage of string
|
||||||
| Redact
|
| Redact
|
||||||
| Rasterize
|
| Rasterize
|
||||||
@ -385,6 +386,7 @@ let string_of_op = function
|
|||||||
| PrintStructTree -> "PrintStructTree"
|
| PrintStructTree -> "PrintStructTree"
|
||||||
| ExtractStructTree -> "ExtractStructTree"
|
| ExtractStructTree -> "ExtractStructTree"
|
||||||
| ReplaceStructTree _ -> "ReplaceStructTree"
|
| ReplaceStructTree _ -> "ReplaceStructTree"
|
||||||
|
| RemoveStructTree -> "RemoveStructTree"
|
||||||
| SetLanguage _ -> "SetLanguage"
|
| SetLanguage _ -> "SetLanguage"
|
||||||
| Redact -> "Redact"
|
| Redact -> "Redact"
|
||||||
| Rasterize -> "Rasterize"
|
| Rasterize -> "Rasterize"
|
||||||
@ -959,7 +961,7 @@ let banned banlist = function
|
|||||||
| OCGRename | OCGList | OCGOrderAll | PrintFontEncoding _ | TableOfContents | Typeset _ | Composition _
|
| OCGRename | OCGList | OCGOrderAll | PrintFontEncoding _ | TableOfContents | Typeset _ | Composition _
|
||||||
| TextWidth _ | SetAnnotations _ | CopyAnnotations _ | ExtractStream _ | ReplaceStream _ | PrintObj _ | ReplaceObj _
|
| TextWidth _ | SetAnnotations _ | CopyAnnotations _ | ExtractStream _ | ReplaceStream _ | PrintObj _ | ReplaceObj _
|
||||||
| Verify _ | MarkAs _ | RemoveMark _ | ExtractStructTree | ReplaceStructTree _ | SetLanguage _
|
| Verify _ | MarkAs _ | RemoveMark _ | ExtractStructTree | ReplaceStructTree _ | SetLanguage _
|
||||||
| PrintStructTree | Rasterize | OutputImage
|
| PrintStructTree | Rasterize | OutputImage | RemoveStructTree
|
||||||
-> false (* Always allowed *)
|
-> false (* Always allowed *)
|
||||||
(* Combine pages is not allowed because we would not know where to get the
|
(* Combine pages is not allowed because we would not know where to get the
|
||||||
-recrypt from -- the first or second file? *)
|
-recrypt from -- the first or second file? *)
|
||||||
@ -4891,6 +4893,10 @@ let go () =
|
|||||||
let json = Cpdfyojson.Safe.from_file s in
|
let json = Cpdfyojson.Safe.from_file s in
|
||||||
Cpdfua.replace_struct_tree pdf json;
|
Cpdfua.replace_struct_tree pdf json;
|
||||||
write_pdf false pdf
|
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) ->
|
| Some (SetLanguage s) ->
|
||||||
let pdf = get_single_pdf args.op false in
|
let pdf = get_single_pdf args.op false in
|
||||||
Cpdfmetadata.set_language pdf s;
|
Cpdfmetadata.set_language pdf s;
|
||||||
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
@ -1850,3 +1850,5 @@ let create_pdfua2 title pagesize pages =
|
|||||||
let pdf = {pdf with Pdf.major = 2; Pdf.minor = 0} in
|
let pdf = {pdf with Pdf.major = 2; Pdf.minor = 0} in
|
||||||
mark2 2024 pdf;
|
mark2 2024 pdf;
|
||||||
pdf
|
pdf
|
||||||
|
|
||||||
|
let remove_struct_tree pdf = ()
|
||||||
|
@ -31,6 +31,9 @@ val extract_struct_tree : Pdf.t -> Cpdfyojson.Safe.t
|
|||||||
(** Reapply an edited JSON structure tree to its PDF. *)
|
(** Reapply an edited JSON structure tree to its PDF. *)
|
||||||
val replace_struct_tree : Pdf.t -> Cpdfyojson.Safe.t -> unit
|
val replace_struct_tree : Pdf.t -> Cpdfyojson.Safe.t -> unit
|
||||||
|
|
||||||
|
(** Remove a structure tree entirely from a file, including unmarking marked content. *)
|
||||||
|
val remove_struct_tree : Pdf.t -> unit
|
||||||
|
|
||||||
(** Make a blank PDF/UA-1 PDF given a title, paper size, and number of pages. *)
|
(** Make a blank PDF/UA-1 PDF given a title, paper size, and number of pages. *)
|
||||||
val create_pdfua1 : string -> Pdfpaper.t -> int -> Pdf.t
|
val create_pdfua1 : string -> Pdfpaper.t -> int -> Pdf.t
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user