From 03dfcdfd3c11cab5a4015c62361140efb81d7f73 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 11 Mar 2025 16:01:31 +0000 Subject: [PATCH] Adds -mark-as-artifact --- cpdfcommand.ml | 9 ++++++++- cpdfmanual.tex | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index afcd181..8c847e8 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -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; diff --git a/cpdfmanual.tex b/cpdfmanual.tex index beacca3..ce5273b 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -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,