diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 0dae4b5..0c26d50 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2044,6 +2044,27 @@ let set_input_png s = let addimage s = addop (Cpdfdraw.Image s) +let addnewpage s = + addop Cpdfdraw.NewPage + +let addopacity f = + addop (Cpdfdraw.Opacity f) + +let addsopacity f = + addop (Cpdfdraw.SOpacity f) + +let addtext s = + addop (Cpdfdraw.Text s) + +let addblock s = + addop (Cpdfdraw.Block ()) + +let addurl s = + addop (Cpdfdraw.URL s) + +let addendurl () = + addop Cpdfdraw.EndURL + let setstderrtostdout () = Pdfe.logger := (fun s -> print_string s; flush stdout) @@ -2878,6 +2899,16 @@ and specs = ("-draw-jpeg", Arg.String addjpeg, " Load a JPEG from file and name it"); ("-draw-png", Arg.String addpng, " Load a PNG from file and name it"); ("-image", Arg.String addimage, " Draw an image which has already been loaded"); + ("-newpage", Arg.Unit addnewpage, " Move to a fresh page"); + ("-opacity", Arg.Float addopacity, " Set opacity"); + ("-sopacity", Arg.Float addsopacity, " Set stroke opacity"); + ("-text", Arg.String addtext, " Draw text and move position. "); + ("-block", Arg.String addblock, " Set up text block"); + ("-url", Arg.String addurl, " Begin URL"); + ("-endurl", Arg.Unit addendurl, " End URL"); + (* Getting information before or whilst drawing *) + (*("-textwidth", ...., "Get width of line of text"); + ("-blocklines", ...., "Get number of lines of text block");*) (* These items are undocumented *) ("-debug", Arg.Unit setdebug, ""); ("-debug-crypt", Arg.Unit setdebugcrypt, ""); diff --git a/cpdfdraw.ml b/cpdfdraw.ml index f165756..18218ff 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -36,6 +36,13 @@ type drawops = | HardXObject of drawops list | Image of string | ImageXObject of string * Pdf.pdfobject + | NewPage + | Opacity of float + | SOpacity of float + | Text of string + | Block of unit (* to fix *) + | URL of string + | EndURL (* Hash table of (human name, (resources name, object)) for image xobjects *) let images = null_hash () @@ -84,6 +91,7 @@ let rec ops_of_drawop pdf = function | ImageXObject (s, obj) -> Hashtbl.add images s (fresh_xobj_name (), Pdf.addobj pdf obj); [] + | NewPage -> Pdfe.log ("NewPage remaining in graphic stream"); assert false and ops_of_drawops pdf drawops = flatten (map (ops_of_drawop pdf) drawops) diff --git a/cpdfdraw.mli b/cpdfdraw.mli index 78e02e4..a367f51 100644 --- a/cpdfdraw.mli +++ b/cpdfdraw.mli @@ -34,5 +34,12 @@ type drawops = | HardXObject of drawops list | Image of string | ImageXObject of string * Pdf.pdfobject + | NewPage + | Opacity of float + | SOpacity of float + | Text of string + | Block of unit (* to fix *) + | URL of string + | EndURL val draw : bool -> int list -> Pdf.t -> drawops list -> Pdf.t