Add -draw-struct-tree
This commit is contained in:
parent
70f201a653
commit
269936be3a
2
Changes
2
Changes
|
@ -7,7 +7,7 @@ o Removed setting of Producer field in AGPL version
|
||||||
* New -args-json for better control files
|
* New -args-json for better control files
|
||||||
* New -replace-obj to edit dictionary entries via chain
|
* New -replace-obj to edit dictionary entries via chain
|
||||||
* Create structure information for files with -draw
|
* Create structure information for files with -draw
|
||||||
* Create PDF/UA files from scratch with -create-pdf-ua1
|
* Create PDF/UA files from scratch with -create-pdf-ua-1
|
||||||
|
|
||||||
* = Supported by a grant from NLnet
|
* = Supported by a grant from NLnet
|
||||||
|
|
||||||
|
|
|
@ -542,7 +542,8 @@ type args =
|
||||||
mutable resample_interpolate : bool;
|
mutable resample_interpolate : bool;
|
||||||
mutable jbig2_lossy_threshold : float;
|
mutable jbig2_lossy_threshold : float;
|
||||||
mutable extract_stream_decompress : bool;
|
mutable extract_stream_decompress : bool;
|
||||||
mutable verify_single : string option}
|
mutable verify_single : string option;
|
||||||
|
mutable draw_struct_tree : bool}
|
||||||
|
|
||||||
let args =
|
let args =
|
||||||
{op = None;
|
{op = None;
|
||||||
|
@ -677,7 +678,8 @@ let args =
|
||||||
resample_interpolate = false;
|
resample_interpolate = false;
|
||||||
jbig2_lossy_threshold = 0.85;
|
jbig2_lossy_threshold = 0.85;
|
||||||
extract_stream_decompress = false;
|
extract_stream_decompress = false;
|
||||||
verify_single = None}
|
verify_single = None;
|
||||||
|
draw_struct_tree = 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 or path_to_* or
|
was_decrypted_with_owner or recrypt or producer or creator or path_to_* or
|
||||||
|
@ -800,7 +802,8 @@ let reset_arguments () =
|
||||||
args.jbig2_lossy_threshold <- 0.85;
|
args.jbig2_lossy_threshold <- 0.85;
|
||||||
args.extract_stream_decompress <- false;
|
args.extract_stream_decompress <- false;
|
||||||
clear Cpdfdrawcontrol.fontpack_initialised;
|
clear Cpdfdrawcontrol.fontpack_initialised;
|
||||||
args.verify_single <- None
|
args.verify_single <- None;
|
||||||
|
args.draw_struct_tree <- false
|
||||||
|
|
||||||
(* Prefer a) the one given with -cpdflin b) a local cpdflin, c) otherwise assume
|
(* Prefer a) the one given with -cpdflin b) a local cpdflin, c) otherwise assume
|
||||||
installed at a system place *)
|
installed at a system place *)
|
||||||
|
@ -1801,6 +1804,9 @@ let settextwidth s =
|
||||||
let setdraw () =
|
let setdraw () =
|
||||||
args.op <- Some Draw
|
args.op <- Some Draw
|
||||||
|
|
||||||
|
let setdrawstructtree () =
|
||||||
|
args.draw_struct_tree <- true
|
||||||
|
|
||||||
let setextractfontfile s =
|
let setextractfontfile s =
|
||||||
args.op <- Some (ExtractFontFile s)
|
args.op <- Some (ExtractFontFile s)
|
||||||
|
|
||||||
|
@ -2782,6 +2788,7 @@ let specs =
|
||||||
Arg.String settextwidth,
|
Arg.String settextwidth,
|
||||||
" Find width of a line of text");
|
" Find width of a line of text");
|
||||||
("-draw", Arg.Unit setdraw, " Begin drawing");
|
("-draw", Arg.Unit setdraw, " Begin drawing");
|
||||||
|
("-draw-struct-tree", Arg.Unit setdrawstructtree, " Build structure trees when drawing.");
|
||||||
("-rect", Arg.String Cpdfdrawcontrol.addrect, " Draw rectangle");
|
("-rect", Arg.String Cpdfdrawcontrol.addrect, " Draw rectangle");
|
||||||
("-to", Arg.String Cpdfdrawcontrol.addto, " Move to");
|
("-to", Arg.String Cpdfdrawcontrol.addto, " Move to");
|
||||||
("-line", Arg.String Cpdfdrawcontrol.addline, " Add line to");
|
("-line", Arg.String Cpdfdrawcontrol.addline, " Add line to");
|
||||||
|
@ -4493,7 +4500,7 @@ let go () =
|
||||||
let ops = match !Cpdfdrawcontrol.drawops with [("_MAIN", ops)] -> rev ops | _ -> error "not enough -end-xobj or -et" in
|
let ops = match !Cpdfdrawcontrol.drawops with [("_MAIN", ops)] -> rev ops | _ -> error "not enough -end-xobj or -et" in
|
||||||
write_pdf
|
write_pdf
|
||||||
false
|
false
|
||||||
(Cpdfdraw.draw ~fast:args.fast ~underneath:args.underneath ~filename:args.original_filename ~bates:args.bates ~batespad:args.batespad range pdf ops)
|
(Cpdfdraw.draw ~struct_tree:args.draw_struct_tree ~fast:args.fast ~underneath:args.underneath ~filename:args.original_filename ~bates:args.bates ~batespad:args.batespad range pdf ops)
|
||||||
| Some (Composition json) ->
|
| Some (Composition json) ->
|
||||||
let pdf = get_single_pdf args.op false in
|
let pdf = get_single_pdf args.op false in
|
||||||
let filesize =
|
let filesize =
|
||||||
|
|
|
@ -422,7 +422,7 @@ let dryrun ~filename ~bates ~batespad range pdf chunks =
|
||||||
restore_whole_stack r;
|
restore_whole_stack r;
|
||||||
fontpacks := saved_fontpacks
|
fontpacks := saved_fontpacks
|
||||||
|
|
||||||
let draw ?(fast=false) ?(underneath=false) ~filename ~bates ~batespad range pdf drawops =
|
let draw ~struct_tree ~fast ~underneath ~filename ~bates ~batespad range pdf drawops =
|
||||||
(*Printf.printf "%s\n" (string_of_drawops drawops);*)
|
(*Printf.printf "%s\n" (string_of_drawops drawops);*)
|
||||||
resstack := [empty_res ()];
|
resstack := [empty_res ()];
|
||||||
Hashtbl.clear !fontpacks;
|
Hashtbl.clear !fontpacks;
|
||||||
|
|
|
@ -52,8 +52,9 @@ type drawops =
|
||||||
|
|
||||||
(** Calling [draw fast underneath filename bates batespad range pdf drawops] draws on
|
(** Calling [draw fast underneath filename bates batespad range pdf drawops] draws on
|
||||||
top of all the pages in the range. *)
|
top of all the pages in the range. *)
|
||||||
val draw : ?fast:bool ->
|
val draw : struct_tree:bool ->
|
||||||
?underneath:bool ->
|
fast:bool ->
|
||||||
|
underneath:bool ->
|
||||||
filename:string ->
|
filename:string ->
|
||||||
bates:int ->
|
bates:int ->
|
||||||
batespad:int option ->
|
batespad:int option ->
|
||||||
|
|
Loading…
Reference in New Issue