more
This commit is contained in:
parent
449a3c2e29
commit
d7d0690546
15
cpdfpage.ml
15
cpdfpage.ml
|
@ -1,8 +1,17 @@
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
open Cpdferror
|
open Cpdferror
|
||||||
|
|
||||||
|
(* FIXME: Need to take account of inherited resources (among Xobjects and their children - pages
|
||||||
|
are regularized upon loading). Would be nice to see a failing example first though.
|
||||||
|
FIXME: What would happen if a pattern was used in a transforming and non-transforming way - we
|
||||||
|
would have to depulicate - again, no failing example available.
|
||||||
|
FIXME: combine change_annotation_matrices, change_pattern_matrices and change_softmask_matrices
|
||||||
|
into one *)
|
||||||
|
|
||||||
(* When we transform a page by wrapping in an [Op_cm], we must also
|
(* When we transform a page by wrapping in an [Op_cm], we must also
|
||||||
change any /Matrix entries in (some) pattern dictionaries, including inside xobjects *)
|
change any /Matrix entries in (some) pattern dictionaries, including inside
|
||||||
|
xobjects. We only change the ones used with scn, to avoid pattern dictionaries
|
||||||
|
used in other ways, which must not be transformed. *)
|
||||||
let patterns_used pdf content resources =
|
let patterns_used pdf content resources =
|
||||||
let used = null_hash () in
|
let used = null_hash () in
|
||||||
match Pdf.lookup_direct pdf "/Pattern" resources with
|
match Pdf.lookup_direct pdf "/Pattern" resources with
|
||||||
|
@ -73,6 +82,10 @@ let change_pattern_matrices_page pdf tr page =
|
||||||
Printf.printf "\n";
|
Printf.printf "\n";
|
||||||
{page with Pdfpage.resources = change_pattern_matrices_resources pdf tr page.Pdfpage.resources used}
|
{page with Pdfpage.resources = change_pattern_matrices_resources pdf tr page.Pdfpage.resources used}
|
||||||
|
|
||||||
|
(* Transparency group soft masks appear to need altering with the inverse of the transformation matrix. We
|
||||||
|
find them all, deduplicate, and then process in place. *)
|
||||||
|
let change_softmask_matrices_page pdf tr page = ()
|
||||||
|
|
||||||
(* Output information for each page *)
|
(* Output information for each page *)
|
||||||
let output_page_info pdf range =
|
let output_page_info pdf range =
|
||||||
let pages = Pdfpage.pages_of_pagetree pdf
|
let pages = Pdfpage.pages_of_pagetree pdf
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
val change_pattern_matrices_page : Pdf.t -> Pdftransform.transform_matrix -> Pdfpage.t -> Pdfpage.t
|
val change_pattern_matrices_page : Pdf.t -> Pdftransform.transform_matrix -> Pdfpage.t -> Pdfpage.t
|
||||||
|
|
||||||
|
val change_softmask_matrices_page : Pdf.t -> Pdftransform.transform_matrix -> Pdfpage.t -> unit
|
||||||
|
|
||||||
(** Print page info (Mediabox etc) to standard output. *)
|
(** Print page info (Mediabox etc) to standard output. *)
|
||||||
val output_page_info : Pdf.t -> int list -> unit
|
val output_page_info : Pdf.t -> int list -> unit
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue