First bit of plumbing for setting of XMP metadata
This commit is contained in:
parent
571c7acf47
commit
c6dd8d18a5
|
@ -172,6 +172,7 @@ type op =
|
||||||
| RemoveDictEntry of string
|
| RemoveDictEntry of string
|
||||||
| ListSpotColours
|
| ListSpotColours
|
||||||
| RemoveClipping
|
| RemoveClipping
|
||||||
|
| SetMetadataDate of string
|
||||||
|
|
||||||
let string_of_op = function
|
let string_of_op = function
|
||||||
| CopyFont _ -> "CopyFont"
|
| CopyFont _ -> "CopyFont"
|
||||||
|
@ -283,6 +284,7 @@ let string_of_op = function
|
||||||
| RemoveArt -> "RemoveArt"
|
| RemoveArt -> "RemoveArt"
|
||||||
| RemoveTrim -> "RemoveTrim"
|
| RemoveTrim -> "RemoveTrim"
|
||||||
| RemoveBleed -> "RemoveBleed"
|
| RemoveBleed -> "RemoveBleed"
|
||||||
|
| SetMetadataDate _ -> "SetMetadataDate"
|
||||||
|
|
||||||
(* Inputs: filename, pagespec. *)
|
(* Inputs: filename, pagespec. *)
|
||||||
type input_kind =
|
type input_kind =
|
||||||
|
@ -395,7 +397,10 @@ type args =
|
||||||
mutable producer : string option;
|
mutable producer : string option;
|
||||||
mutable embedfonts : bool;
|
mutable embedfonts : bool;
|
||||||
mutable extract_text_font_size : float option;
|
mutable extract_text_font_size : float option;
|
||||||
mutable padwith : string option}
|
mutable padwith : string option;
|
||||||
|
mutable alsosetxml : bool;
|
||||||
|
mutable alsosetxmlwhenpresent : bool;
|
||||||
|
mutable justsetxml : bool}
|
||||||
|
|
||||||
let args =
|
let args =
|
||||||
{op = None;
|
{op = None;
|
||||||
|
@ -481,7 +486,10 @@ let args =
|
||||||
creator = None;
|
creator = None;
|
||||||
embedfonts = true;
|
embedfonts = true;
|
||||||
extract_text_font_size = None;
|
extract_text_font_size = None;
|
||||||
padwith = None}
|
padwith = None;
|
||||||
|
alsosetxml = false;
|
||||||
|
alsosetxmlwhenpresent = false;
|
||||||
|
justsetxml = false}
|
||||||
|
|
||||||
let reset_arguments () =
|
let reset_arguments () =
|
||||||
args.op <- None;
|
args.op <- None;
|
||||||
|
@ -560,7 +568,10 @@ let reset_arguments () =
|
||||||
args.squeeze <- false;
|
args.squeeze <- false;
|
||||||
args.embedfonts <- true;
|
args.embedfonts <- true;
|
||||||
args.extract_text_font_size <- None;
|
args.extract_text_font_size <- None;
|
||||||
args.padwith <- None
|
args.padwith <- None;
|
||||||
|
args.alsosetxml <- false;
|
||||||
|
args.alsosetxmlwhenpresent <- false;
|
||||||
|
args.justsetxml <- false
|
||||||
(* Do not reset original_filename or cpdflin or was_encrypted or
|
(* Do not reset original_filename or cpdflin or was_encrypted or
|
||||||
* was_decrypted_with_owner or recrypt or producer or creator, since we want
|
* was_decrypted_with_owner or recrypt or producer or creator, since we want
|
||||||
* these to work across ANDs. *)
|
* these to work across ANDs. *)
|
||||||
|
@ -633,7 +644,7 @@ let banned banlist = function
|
||||||
AddText _|ScaleContents _|AttachFile _|CopyAnnotations _|SetMetadata _|
|
AddText _|ScaleContents _|AttachFile _|CopyAnnotations _|SetMetadata _|
|
||||||
ThinLines _|SetAuthor _|SetTitle _|SetSubject _|SetKeywords _|SetCreate _|
|
ThinLines _|SetAuthor _|SetTitle _|SetSubject _|SetKeywords _|SetCreate _|
|
||||||
SetModify _|SetCreator _|SetProducer _|SetVersion _|RemoveDictEntry _ |
|
SetModify _|SetCreator _|SetProducer _|SetVersion _|RemoveDictEntry _ |
|
||||||
RemoveClipping ->
|
RemoveClipping | SetMetadataDate _ ->
|
||||||
mem Pdfcrypt.NoEdit banlist
|
mem Pdfcrypt.NoEdit banlist
|
||||||
|
|
||||||
let operation_allowed pdf banlist op =
|
let operation_allowed pdf banlist op =
|
||||||
|
@ -1569,6 +1580,15 @@ let setnoembedfont () =
|
||||||
let sethardbox box =
|
let sethardbox box =
|
||||||
args.op <- Some (HardBox box)
|
args.op <- Some (HardBox box)
|
||||||
|
|
||||||
|
let setalsosetxml () =
|
||||||
|
args.alsosetxml <- true
|
||||||
|
|
||||||
|
let setalsosetxmlwhenpresent () =
|
||||||
|
args.alsosetxmlwhenpresent <- true
|
||||||
|
|
||||||
|
let setjustsetxml () =
|
||||||
|
args.justsetxml <- true
|
||||||
|
|
||||||
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
||||||
let rec make_control_argv_and_parse filename =
|
let rec make_control_argv_and_parse filename =
|
||||||
control_args := !control_args @ parse_control_file filename
|
control_args := !control_args @ parse_control_file filename
|
||||||
|
@ -1989,6 +2009,15 @@ and specs =
|
||||||
("-set-untrapped",
|
("-set-untrapped",
|
||||||
Arg.Unit (setop SetUntrapped),
|
Arg.Unit (setop SetUntrapped),
|
||||||
" Mark as not trapped");
|
" Mark as not trapped");
|
||||||
|
("-also-set-xml",
|
||||||
|
Arg.Unit setalsosetxml,
|
||||||
|
" Also set XML metadata");
|
||||||
|
("-also-set-xml-when-present",
|
||||||
|
Arg.Unit setalsosetxmlwhenpresent,
|
||||||
|
" Also set XML metadata, but only if field already present");
|
||||||
|
("-just-set-xml",
|
||||||
|
Arg.Unit setjustsetxml,
|
||||||
|
" Just set XML metadata, not old-fashioned metadata");
|
||||||
("-set-page-layout",
|
("-set-page-layout",
|
||||||
Arg.String setpagelayout,
|
Arg.String setpagelayout,
|
||||||
" Set page layout upon document opening");
|
" Set page layout upon document opening");
|
||||||
|
|
Loading…
Reference in New Issue