more
This commit is contained in:
parent
98c80a3c7a
commit
bfcfaddec3
|
@ -2,6 +2,8 @@
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
open Cpdferror
|
open Cpdferror
|
||||||
|
|
||||||
|
let used = null_hash ()
|
||||||
|
|
||||||
type color =
|
type color =
|
||||||
Grey of float
|
Grey of float
|
||||||
| RGB of float * float * float
|
| RGB of float * float * float
|
||||||
|
@ -48,7 +50,7 @@ let colour_op_stroke = function
|
||||||
| Grey g -> Pdfops.Op_G g
|
| Grey g -> Pdfops.Op_G g
|
||||||
| CYMK (c, y, m, k) -> Pdfops.Op_K (c, y, m, k)
|
| CYMK (c, y, m, k) -> Pdfops.Op_K (c, y, m, k)
|
||||||
|
|
||||||
let ops used longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_extgstatename colour fontsize text =
|
let ops longest_w x y rotate hoffset voffset outline linewidth unique_fontname unique_extgstatename colour fontsize text =
|
||||||
String.iter (fun x -> Hashtbl.replace used x ()) text;
|
String.iter (fun x -> Hashtbl.replace used x ()) text;
|
||||||
[Pdfops.Op_q;
|
[Pdfops.Op_q;
|
||||||
Pdfops.Op_BMC "/CPDFSTAMP";
|
Pdfops.Op_BMC "/CPDFSTAMP";
|
||||||
|
@ -293,7 +295,7 @@ let pagelabel pdf num =
|
||||||
(Pdfpagelabels.complete (Pdfpagelabels.read pdf))
|
(Pdfpagelabels.complete (Pdfpagelabels.read pdf))
|
||||||
|
|
||||||
let addtext
|
let addtext
|
||||||
time used lines linewidth outline fast colour fontname encoding embed bates batespad fontsize
|
time lines linewidth outline fast colour fontname encoding embed bates batespad fontsize
|
||||||
(font : Pdftext.font option)
|
(font : Pdftext.font option)
|
||||||
fontpdfobj underneath position hoffset voffset text pages orientation cropbox opacity
|
fontpdfobj underneath position hoffset voffset text pages orientation cropbox opacity
|
||||||
justification filename extract_text_font_size shift pdf
|
justification filename extract_text_font_size shift pdf
|
||||||
|
@ -410,11 +412,11 @@ let addtext
|
||||||
in
|
in
|
||||||
match font with
|
match font with
|
||||||
| Some f ->
|
| Some f ->
|
||||||
ops used longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
|
ops longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
|
||||||
unique_fontname unique_extgstatename colour fontsize text,
|
unique_fontname unique_extgstatename colour fontsize text,
|
||||||
urls, x, y, hoffset, voffset, text, joffset
|
urls, x, y, hoffset, voffset, text, joffset
|
||||||
| None ->
|
| None ->
|
||||||
ops used longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
|
ops longest_w (x +. shift_x) (y +. shift_y) rotate (hoffset +. joffset) voffset outline linewidth
|
||||||
fontname None colour fontsize text,
|
fontname None colour fontsize text,
|
||||||
urls, x, y, hoffset, voffset, text, joffset
|
urls, x, y, hoffset, voffset, text, joffset
|
||||||
in
|
in
|
||||||
|
@ -506,7 +508,6 @@ let
|
||||||
midline topline filename extract_text_font_size shift ?(raw=false) pdf
|
midline topline filename extract_text_font_size shift ?(raw=false) pdf
|
||||||
=
|
=
|
||||||
let time = Cpdfstrftime.current_time () in
|
let time = Cpdfstrftime.current_time () in
|
||||||
let used = null_hash () in
|
|
||||||
if pages = [] then error "addtexts: empty page range" else
|
if pages = [] then error "addtexts: empty page range" else
|
||||||
let realfontname = ref fontname in
|
let realfontname = ref fontname in
|
||||||
let fontpdfobj =
|
let fontpdfobj =
|
||||||
|
@ -589,7 +590,7 @@ let
|
||||||
(fun line ->
|
(fun line ->
|
||||||
let voff, hoff = !voffset, 0. in
|
let voff, hoff = !voffset, 0. in
|
||||||
pdf :=
|
pdf :=
|
||||||
addtext time used lines linewidth outline fast colour !realfontname encoding
|
addtext time lines linewidth outline fast colour !realfontname encoding
|
||||||
embed bates batespad fontsize font fontpdfobj underneath position hoff voff line
|
embed bates batespad fontsize font fontpdfobj underneath position hoff voff line
|
||||||
pages orientation cropbox opacity justification filename
|
pages orientation cropbox opacity justification filename
|
||||||
extract_text_font_size shift
|
extract_text_font_size shift
|
||||||
|
|
Loading…
Reference in New Issue