Adds -mark-as-artifact

This commit is contained in:
John Whitington
2025-03-11 16:01:31 +00:00
parent 7032722ad6
commit 03dfcdfd3c
2 changed files with 10 additions and 2 deletions

View File

@ -230,6 +230,7 @@ type op =
| ExtractStructTree
| ReplaceStructTree of string
| RemoveStructTree
| MarkAsArtifact
| SetLanguage of string
| Redact
| Rasterize
@ -387,6 +388,7 @@ let string_of_op = function
| ExtractStructTree -> "ExtractStructTree"
| ReplaceStructTree _ -> "ReplaceStructTree"
| RemoveStructTree -> "RemoveStructTree"
| MarkAsArtifact -> "MarkAsArtifact"
| SetLanguage _ -> "SetLanguage"
| Redact -> "Redact"
| Rasterize -> "Rasterize"
@ -961,7 +963,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 | RemoveStructTree
| PrintStructTree | Rasterize | OutputImage | RemoveStructTree | MarkAsArtifact
-> false (* Always allowed *)
(* Combine pages is not allowed because we would not know where to get the
-recrypt from -- the first or second file? *)
@ -3033,6 +3035,7 @@ let specs =
("-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");
("-remove-struct-tree", Arg.Unit (fun () -> setop RemoveStructTree ()), " Remove entire structure tree");
("-mark-as-artifact", Arg.Unit (fun () -> setop MarkAsArtifact ()), " Mark whole file as artifact");
("-redact", Arg.Unit (fun () -> setop Redact ()), " Redact entire pages");
("-rasterize", Arg.Unit (fun () -> setop Rasterize ()), " Rasterize pages");
("-rasterize-gray", Arg.Unit (fun () -> args.rast_device <- "pnggray"), " Rasterize in grayscale");
@ -4899,6 +4902,10 @@ let go () =
let pdf = get_single_pdf args.op false in
let pdf = Cpdfpage.remove_struct_tree pdf in
write_pdf false pdf
| Some MarkAsArtifact ->
let pdf = get_single_pdf args.op false in
let pdf = Cpdfpage.mark_all_as_artifact pdf in
write_pdf false pdf
| Some (SetLanguage s) ->
let pdf = get_single_pdf args.op false in
Cpdfmetadata.set_language pdf s;

View File

@ -1,4 +1,5 @@
%Edit -process-struct-tree with -stamp-on, -stamp-under, -combine-pages, new combine pages stuff
%Document -process-struct-tree with -stamp-on, -stamp-under, -combine-pages, new combine pages stuff
%Document -mark-as-artifact
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
\documentclass{book}
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,