more
This commit is contained in:
parent
609943e78c
commit
d7e9a79e73
19
cpdf.ml
19
cpdf.ml
|
@ -2933,7 +2933,9 @@ let impose_pages fit x y columns rtl btt center margin output_mediabox fast fit_
|
||||||
| [] -> assert false
|
| [] -> assert false
|
||||||
| (h::_) as pages ->
|
| (h::_) as pages ->
|
||||||
let transforms =
|
let transforms =
|
||||||
impose_transforms fit x y columns rtl btt center margin h.Pdfpage.mediabox output_mediabox fit_extra_hspace fit_extra_vspace (length pages)
|
impose_transforms
|
||||||
|
fit x y columns rtl btt center margin h.Pdfpage.mediabox
|
||||||
|
output_mediabox fit_extra_hspace fit_extra_vspace (length pages)
|
||||||
in
|
in
|
||||||
(* Change the pattern matrices before combining resources *)
|
(* Change the pattern matrices before combining resources *)
|
||||||
let pages, h =
|
let pages, h =
|
||||||
|
@ -2946,22 +2948,17 @@ let impose_pages fit x y columns rtl btt center margin output_mediabox fast fit_
|
||||||
let transform_stream transform contents =
|
let transform_stream transform contents =
|
||||||
(* If fast, no mismatched q/Q protection and no parsing of operators. *)
|
(* If fast, no mismatched q/Q protection and no parsing of operators. *)
|
||||||
if fast then
|
if fast then
|
||||||
let before = Pdfops.stream_of_ops [Pdfops.Op_q; Pdfops.Op_cm transform] in
|
[Pdfops.stream_of_ops [Pdfops.Op_q; Pdfops.Op_cm transform]] @ contents @ [Pdfops.stream_of_ops [Pdfops.Op_Q]]
|
||||||
let after = Pdfops.stream_of_ops [Pdfops.Op_Q] in
|
|
||||||
[before] @ contents @ [after]
|
|
||||||
else
|
else
|
||||||
(* If slow, use protect from Pdfpage. *)
|
(* If slow, use protect from Pdfpage. *)
|
||||||
let ops = Pdfpage.protect pdf resources' contents @ Pdfops.parse_operators pdf resources' contents in
|
let ops = Pdfpage.protect pdf resources' contents @ Pdfops.parse_operators pdf resources' contents in
|
||||||
[Pdfops.stream_of_ops
|
[Pdfops.stream_of_ops ([Pdfops.Op_q] @ [Pdfops.Op_cm transform] @ ops @ [Pdfops.Op_Q])]
|
||||||
([Pdfops.Op_q] @ [Pdfops.Op_cm transform] @ ops @ [Pdfops.Op_Q])]
|
|
||||||
in
|
in
|
||||||
flatten
|
flatten
|
||||||
(map2
|
(map2
|
||||||
(fun p t ->
|
(fun p t -> transform_annotations pdf t p.Pdfpage.rest; transform_stream t p.Pdfpage.content)
|
||||||
transform_annotations pdf t p.Pdfpage.rest;
|
pages
|
||||||
transform_stream t p.Pdfpage.content)
|
transforms)
|
||||||
pages
|
|
||||||
transforms)
|
|
||||||
in
|
in
|
||||||
{Pdfpage.mediabox = output_mediabox;
|
{Pdfpage.mediabox = output_mediabox;
|
||||||
Pdfpage.rotate = h.Pdfpage.rotate;
|
Pdfpage.rotate = h.Pdfpage.rotate;
|
||||||
|
|
Loading…
Reference in New Issue