Clean up duplicated ppstub
This commit is contained in:
parent
187ef76262
commit
b6c5439829
|
@ -6,10 +6,6 @@ type color =
|
||||||
| RGB of float * float * float
|
| RGB of float * float * float
|
||||||
| CYMK of float * float * float * float
|
| CYMK of float * float * float * float
|
||||||
|
|
||||||
(* For uses of process_pages which don't need to deal with matrices, this
|
|
||||||
function transforms into one which returns the identity matrix *)
|
|
||||||
let ppstub f n p = (f n p, n, Pdftransform.i_matrix)
|
|
||||||
|
|
||||||
(* \section{Superimpose text, page numbers etc.} *)
|
(* \section{Superimpose text, page numbers etc.} *)
|
||||||
|
|
||||||
(* Process UTF8 text to /WinAnsiEncoding string (for standard 14) or whatever
|
(* Process UTF8 text to /WinAnsiEncoding string (for standard 14) or whatever
|
||||||
|
@ -413,7 +409,7 @@ let addtext
|
||||||
if metrics then
|
if metrics then
|
||||||
(ignore (Cpdfpage.iter_pages (fun a b -> ignore (addtext_page a b)) pdf pages); pdf)
|
(ignore (Cpdfpage.iter_pages (fun a b -> ignore (addtext_page a b)) pdf pages); pdf)
|
||||||
else
|
else
|
||||||
Cpdfpage.process_pages (ppstub addtext_page) pdf pages
|
Cpdfpage.process_pages (Cpdfutil.ppstub addtext_page) pdf pages
|
||||||
|
|
||||||
(* Prev is a list of lists of characters *)
|
(* Prev is a list of lists of characters *)
|
||||||
let split_at_newline t =
|
let split_at_newline t =
|
||||||
|
@ -578,7 +574,7 @@ let removetext range pdf =
|
||||||
let ops = Pdfops.parse_operators pdf page.Pdfpage.resources page.Pdfpage.content in
|
let ops = Pdfops.parse_operators pdf page.Pdfpage.resources page.Pdfpage.content in
|
||||||
[Pdfops.stream_of_ops (remove_stamps [] ops)]}
|
[Pdfops.stream_of_ops (remove_stamps [] ops)]}
|
||||||
in
|
in
|
||||||
Cpdfpage.process_pages (ppstub removetext_page) pdf range
|
Cpdfpage.process_pages (Cpdfutil.ppstub removetext_page) pdf range
|
||||||
|
|
||||||
let addrectangle
|
let addrectangle
|
||||||
fast (w, h) colour outline linewidth opacity position relative_to_cropbox
|
fast (w, h) colour outline linewidth opacity position relative_to_cropbox
|
||||||
|
@ -642,7 +638,7 @@ let addrectangle
|
||||||
then Pdfpage.prepend_operators pdf ops ~fast:fast page
|
then Pdfpage.prepend_operators pdf ops ~fast:fast page
|
||||||
else Pdfpage.postpend_operators pdf ops ~fast:fast page
|
else Pdfpage.postpend_operators pdf ops ~fast:fast page
|
||||||
in
|
in
|
||||||
Cpdfpage.process_pages (ppstub addrectangle_page) pdf range
|
Cpdfpage.process_pages (Cpdfutil.ppstub addrectangle_page) pdf range
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
|
|
||||||
let rec remove_all_text_ops pdf resources content =
|
let rec remove_all_text_ops pdf resources content =
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
|
|
||||||
(* For uses of process_pages which don't need to deal with matrices, this
|
|
||||||
function transforms into one which returns the identity matrix *)
|
|
||||||
let ppstub f n p = (f n p, n, Pdftransform.i_matrix)
|
|
||||||
|
|
||||||
(* \section{List annotations} *)
|
(* \section{List annotations} *)
|
||||||
let get_annotation_string encoding pdf annot =
|
let get_annotation_string encoding pdf annot =
|
||||||
match Pdf.lookup_direct pdf "/Contents" annot with
|
match Pdf.lookup_direct pdf "/Contents" annot with
|
||||||
|
@ -185,4 +181,4 @@ let remove_annotations range pdf =
|
||||||
else
|
else
|
||||||
page
|
page
|
||||||
in
|
in
|
||||||
Cpdfpage.process_pages (ppstub remove_annotations_page) pdf range
|
Cpdfpage.process_pages (Cpdfutil.ppstub remove_annotations_page) pdf range
|
||||||
|
|
|
@ -871,9 +871,6 @@ let rec decrypt_if_necessary (_, _, user_pw, owner_pw, was_dec_with_owner, _) op
|
||||||
if args.debugcrypt then Printf.printf "Failed to decrypt with user password: raising soft_error";
|
if args.debugcrypt then Printf.printf "Failed to decrypt with user password: raising soft_error";
|
||||||
soft_error "Failed to decrypt file: wrong password?"
|
soft_error "Failed to decrypt file: wrong password?"
|
||||||
|
|
||||||
(* Duplicated from cpdf.ml -> fix *)
|
|
||||||
let ppstub f n p = (f n p, n, Pdftransform.i_matrix)
|
|
||||||
|
|
||||||
(* Output Page Count *)
|
(* Output Page Count *)
|
||||||
let output_page_count pdf =
|
let output_page_count pdf =
|
||||||
Printf.printf "%i\n" (Pdfpage.endpage pdf)
|
Printf.printf "%i\n" (Pdfpage.endpage pdf)
|
||||||
|
|
Loading…
Reference in New Issue