Skeleton for -chop

This commit is contained in:
John Whitington 2023-11-15 17:26:43 +00:00
parent 57be1bc127
commit 6357f8f610
4 changed files with 18 additions and 5 deletions

View File

@ -6,8 +6,8 @@ DOC = cpdfunicodedata cpdferror cpdfdebug cpdfjson cpdfstrftime cpdfcoord \
cpdfbookmarks cpdfpage cpdftruetype cpdfremovetext cpdfextracttext \ cpdfbookmarks cpdfpage cpdftruetype cpdfremovetext cpdfextracttext \
cpdfembed cpdffont cpdftype cpdfaddtext cpdfpad cpdfocg \ cpdfembed cpdffont cpdftype cpdfaddtext cpdfpad cpdfocg \
cpdfsqueeze cpdfdraft cpdfspot cpdfpagelabels cpdfcreate cpdfannot \ cpdfsqueeze cpdfdraft cpdfspot cpdfpagelabels cpdfcreate cpdfannot \
cpdfxobject cpdfimpose cpdftweak cpdftexttopdf cpdftoc cpdfjpeg \ cpdfxobject cpdfimpose cpdfchop cpdftweak cpdftexttopdf cpdftoc \
cpdfpng cpdfimage cpdfdraw cpdfcomposition cpdfshape \ cpdfjpeg cpdfpng cpdfimage cpdfdraw cpdfcomposition cpdfshape \
cpdfcolours cpdfdrawcontrol cpdfcommand cpdfcolours cpdfdrawcontrol cpdfcommand
MODS = $(NONDOC) $(DOC) MODS = $(NONDOC) $(DOC)

5
cpdfchop.ml Normal file
View File

@ -0,0 +1,5 @@
open Pdfutil
open Cpdferror
(* Chop pages into pieces *)
let chop ~x ~y pdf range = pdf

4
cpdfchop.mli Normal file
View File

@ -0,0 +1,4 @@
(** Chop *)
(** Chop *)
val chop : x:int -> y:int -> Pdf.t -> int list -> Pdf.t

View File

@ -2,8 +2,8 @@
let demo = false let demo = false
let noncomp = false let noncomp = false
let major_version = 2 let major_version = 2
let minor_version = 6 let minor_version = 7
let version_date = "(patch 2, 25th October 2023)" let version_date = "(devel, 15th November 2023)"
open Pdfutil open Pdfutil
open Pdfio open Pdfio
@ -229,6 +229,7 @@ type op =
| TextWidth of string | TextWidth of string
| Draw | Draw
| Composition of bool | Composition of bool
| Chop of int * int
let string_of_op = function let string_of_op = function
| PrintFontEncoding _ -> "PrintFontEncoding" | PrintFontEncoding _ -> "PrintFontEncoding"
@ -365,6 +366,7 @@ let string_of_op = function
| TextWidth _ -> "TextWidth" | TextWidth _ -> "TextWidth"
| Draw -> "Draw" | Draw -> "Draw"
| Composition _ -> "Composition" | Composition _ -> "Composition"
| Chop _ -> "Chop"
(* Inputs: filename, pagespec. *) (* Inputs: filename, pagespec. *)
type input_kind = type input_kind =
@ -853,7 +855,7 @@ let banned banlist = function
| 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 _ | Spray | RotateContents _ | Rotate _ | Merge | Split | SplitOnBookmarks _ | SplitMax _ | Spray | RotateContents _ | Rotate _
| Rotateby _ | Upright | VFlip | HFlip | Impose _ -> | Rotateby _ | Upright | VFlip | HFlip | Impose _ | Chop _ ->
mem Pdfcrypt.NoAssemble banlist mem Pdfcrypt.NoAssemble banlist
| TwoUp|TwoUpStack|RemoveBookmarks|AddRectangle|RemoveText| | TwoUp|TwoUpStack|RemoveBookmarks|AddRectangle|RemoveText|
Draft|Shift|Scale|ScaleToFit|RemoveAttachedFiles| Draft|Shift|Scale|ScaleToFit|RemoveAttachedFiles|
@ -4369,6 +4371,8 @@ let go () =
| _ -> 0 | _ -> 0
in in
Cpdfcomposition.show_composition filesize json pdf Cpdfcomposition.show_composition filesize json pdf
| Some (Chop (x, y)) ->
()
(* Advise the user if a combination of command line flags makes little sense, (* Advise the user if a combination of command line flags makes little sense,
or error out if it make no sense at all. *) or error out if it make no sense at all. *)