Skeleton for -namespace
This commit is contained in:
parent
e3f9631656
commit
fc28d8c469
|
@ -404,6 +404,9 @@ let spray_outputs = ref []
|
|||
(* A list of PDFs to be output, if no output method was specified. *)
|
||||
let output_pdfs : Pdf.t list ref = ref []
|
||||
|
||||
let standard_namespace = "http://iso.org/pdf/ssn"
|
||||
let pdf2_namespace = "http://iso.org/pdf2/ssn"
|
||||
|
||||
type font =
|
||||
| StandardFont of Pdftext.standard_font
|
||||
| EmbeddedFont of string
|
||||
|
@ -1885,6 +1888,11 @@ let setreplaceobj s =
|
|||
| [a; b] -> args.op <- Some (ReplaceObj (a, b))
|
||||
| _ -> error "replace_obj: bad specification"
|
||||
|
||||
let expand_namespace = function
|
||||
| "PDF" -> standard_namespace
|
||||
| "PDF2" -> pdf2_namespace
|
||||
| x -> x
|
||||
|
||||
let specs =
|
||||
[("-version",
|
||||
Arg.Unit (setop Version),
|
||||
|
@ -2813,6 +2821,7 @@ let specs =
|
|||
("-artifact", Arg.Unit (fun _ -> Cpdfdrawcontrol.artifact ()), " Begin an artifact");
|
||||
("-end-artifact", Arg.Unit (fun _ -> Cpdfdrawcontrol.endartifact ()), "End an artifact");
|
||||
("-no-auto-artifacts", Arg.Unit (fun _ -> Cpdfdrawcontrol.autoartifacts false), " Don't mark untagged content as artifacts");
|
||||
("-namespace", Arg.String (fun s -> Cpdfdrawcontrol.addnamespace (expand_namespace s)), " Set the structure tree namespace");
|
||||
("-rect", Arg.String Cpdfdrawcontrol.addrect, " Draw rectangle");
|
||||
("-to", Arg.String Cpdfdrawcontrol.addto, " Move to");
|
||||
("-line", Arg.String Cpdfdrawcontrol.addline, " Add line to");
|
||||
|
|
|
@ -64,6 +64,7 @@ type drawops =
|
|||
| EndSTag
|
||||
| BeginArtifact
|
||||
| EndArtifact
|
||||
| Namespace of string
|
||||
|
||||
(*let rec string_of_drawop = function
|
||||
| Qq o -> "Qq (" ^ string_of_drawops o ^ ")"
|
||||
|
@ -238,6 +239,11 @@ let mcidr = ref ~-1
|
|||
let mcid () = (incr mcidr; !mcidr)
|
||||
let mcpage = ref ~-1
|
||||
|
||||
let standard_namespace = "http://iso.org/pdf/ssn"
|
||||
let pdf2_namespace = "http://iso.org/pdf2/ssn"
|
||||
|
||||
let namespace = ref standard_namespace
|
||||
|
||||
(* The structure data, as it is created, in flat form. Later on, this will be
|
||||
reconstructed into a structure tree. *)
|
||||
type structdata =
|
||||
|
@ -429,6 +435,7 @@ let rec ops_of_drawop struct_tree dryrun pdf endpage filename bates batespad num
|
|||
| EndSTag -> if not dryrun then structdata =| StDataEndTree; []
|
||||
| BeginArtifact -> [Pdfops.Op_BMC "/BeginArtifact"]
|
||||
| EndArtifact -> [Pdfops.Op_BMC "/EndArtifact"]
|
||||
| Namespace s -> if not dryrun then namespace := s; []
|
||||
|
||||
and ops_of_drawops struct_tree dryrun pdf endpage filename bates batespad num page drawops =
|
||||
flatten (map (ops_of_drawop struct_tree dryrun pdf endpage filename bates batespad num page) drawops)
|
||||
|
|
|
@ -59,6 +59,7 @@ type drawops =
|
|||
| EndSTag
|
||||
| BeginArtifact
|
||||
| EndArtifact
|
||||
| Namespace of string
|
||||
|
||||
val do_add_artifacts : bool ref
|
||||
|
||||
|
|
|
@ -119,6 +119,9 @@ let artifact () =
|
|||
let endartifact () =
|
||||
addop Cpdfdraw.EndArtifact
|
||||
|
||||
let addnamespace s =
|
||||
addop (Cpdfdraw.Namespace s)
|
||||
|
||||
let addrect s =
|
||||
let x, y, w, h = Cpdfcoord.parse_rectangle (Pdf.empty ()) s in
|
||||
addop (Cpdfdraw.Rect (x, y, w, h))
|
||||
|
|
|
@ -19,6 +19,7 @@ val addstag : string -> unit
|
|||
val endtag : unit -> unit
|
||||
val endstag : unit -> unit
|
||||
val autotags : bool -> unit
|
||||
val addnamespace : string -> unit
|
||||
val artifact : unit -> unit
|
||||
val endartifact : unit -> unit
|
||||
val autoartifacts : bool -> unit
|
||||
|
|
Loading…
Reference in New Issue