From d7d06905464673c12f85e75af775301e6968aaed Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 10 Apr 2023 19:55:41 +0100 Subject: [PATCH] more --- cpdfpage.ml | 15 ++++++++++++++- cpdfpage.mli | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cpdfpage.ml b/cpdfpage.ml index 690649a..39021a6 100644 --- a/cpdfpage.ml +++ b/cpdfpage.ml @@ -1,8 +1,17 @@ open Pdfutil 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 -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 used = null_hash () in match Pdf.lookup_direct pdf "/Pattern" resources with @@ -73,6 +82,10 @@ let change_pattern_matrices_page pdf tr page = Printf.printf "\n"; {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 *) let output_page_info pdf range = let pages = Pdfpage.pages_of_pagetree pdf diff --git a/cpdfpage.mli b/cpdfpage.mli index da5a97b..368dbe9 100644 --- a/cpdfpage.mli +++ b/cpdfpage.mli @@ -2,6 +2,8 @@ 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. *) val output_page_info : Pdf.t -> int list -> unit