Machinary for -spray

This commit is contained in:
John Whitington 2023-10-30 16:36:41 +00:00
parent 99a43a24a5
commit d26e6ed8f1
1 changed files with 11 additions and 2 deletions

View File

@ -129,6 +129,7 @@ type op =
| Split | Split
| SplitOnBookmarks of int | SplitOnBookmarks of int
| SplitMax of int | SplitMax of int
| Spray
| Clean | Clean
| Info | Info
| PageInfo | PageInfo
@ -265,6 +266,7 @@ let string_of_op = function
| Split -> "Split" | Split -> "Split"
| SplitOnBookmarks _ -> "SplitOnBookmarks" | SplitOnBookmarks _ -> "SplitOnBookmarks"
| SplitMax _ -> "SplitMax" | SplitMax _ -> "SplitMax"
| Spray -> "Spray"
| Clean -> "Clean" | Clean -> "Clean"
| Info -> "Info" | Info -> "Info"
| PageInfo -> "PageInfo" | PageInfo -> "PageInfo"
@ -378,6 +380,9 @@ type output_method =
| Stdout | Stdout
| File of string | File of string
(* Outputs are also added here, in case -spray is in use. *)
let spray_outputs = ref []
(* A list of PDFs to be output, if no output method was specified. *) (* A list of PDFs to be output, if no output method was specified. *)
let output_pdfs : Pdf.t list ref = ref [] let output_pdfs : Pdf.t list ref = ref []
@ -841,7 +846,7 @@ let banned banlist = function
-recrypt from -- the first or second file? *) -recrypt from -- the first or second file? *)
| Decrypt | Encrypt | CombinePages _ -> true (* Never allowed *) | Decrypt | Encrypt | CombinePages _ -> true (* Never allowed *)
| AddBookmarks _ | PadBefore | PadAfter | PadEvery _ | PadMultiple _ | PadMultipleBefore _ | AddBookmarks _ | PadBefore | PadAfter | PadEvery _ | PadMultiple _ | PadMultipleBefore _
| Merge | Split | SplitOnBookmarks _ | SplitMax _ | RotateContents _ | Rotate _ | Merge | Split | SplitOnBookmarks _ | SplitMax _ | Spray | RotateContents _ | Rotate _
| Rotateby _ | Upright | VFlip | HFlip | Impose _ -> | Rotateby _ | Upright | VFlip | HFlip | Impose _ ->
mem Pdfcrypt.NoAssemble banlist mem Pdfcrypt.NoAssemble banlist
| TwoUp|TwoUpStack|RemoveBookmarks|AddRectangle|RemoveText| | TwoUp|TwoUpStack|RemoveBookmarks|AddRectangle|RemoveText|
@ -918,7 +923,8 @@ let setop op () =
args.op <- Some op args.op <- Some op
let setout name = let setout name =
args.out <- File name args.out <- File name;
spray_outputs := name::!spray_outputs
let setchunk c = let setchunk c =
if c > 0 if c > 0
@ -3783,6 +3789,9 @@ let go () =
| Stdout -> error "Can't split to standard output" | Stdout -> error "Can't split to standard output"
| NoOutputSpecified -> error "Split: No output format specified" | NoOutputSpecified -> error "Split: No output format specified"
end end
| Some Spray ->
()
(* FIXME First deduplicate the enc stuff in this and previous entries *)
| Some Presentation -> | Some Presentation ->
let pdf = get_single_pdf args.op false in let pdf = get_single_pdf args.op false in
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in