This commit is contained in:
John Whitington 2023-05-08 14:15:03 +01:00
parent 60c191e60b
commit 602f1eafdd
1 changed files with 5 additions and 3 deletions

View File

@ -236,7 +236,7 @@ let contains_specials drawops =
List.exists (function SpecialText _ -> true | _ -> false) drawops List.exists (function SpecialText _ -> true | _ -> false) drawops
let draw_single ~filename ~bates ~batespad fast range pdf drawops = let draw_single ~filename ~bates ~batespad fast range pdf drawops =
res.num <- minimum_resource_number pdf range; res.num <- max res.num (minimum_resource_number pdf range);
let endpage = Pdfpage.endpage pdf in let endpage = Pdfpage.endpage pdf in
let pages = Pdfpage.pages_of_pagetree pdf in let pages = Pdfpage.pages_of_pagetree pdf in
let str = let str =
@ -261,8 +261,9 @@ let draw_single ~filename ~bates ~batespad fast range pdf drawops =
option_map (fun (_, (n, o)) -> if mem n res.page_names then Some (n, Pdf.Indirect o) else None) (list_of_hashtbl t) option_map (fun (_, (n, o)) -> if mem n res.page_names then Some (n, Pdf.Indirect o) else None) (list_of_hashtbl t)
in in
let pages = let pages =
map map2
(fun p -> (fun n p ->
if not (mem n range) then p else
let new_resources = let new_resources =
let update = fold_right (fun (k, v) d -> add k v d) in let update = fold_right (fun (k, v) d -> add k v d) in
let new_gss = update gss_resources (read_resource pdf "/ExtGState" p) in let new_gss = update gss_resources (read_resource pdf "/ExtGState" p) in
@ -281,6 +282,7 @@ let draw_single ~filename ~bates ~batespad fast range pdf drawops =
(Pdf.Dictionary new_fonts) (Pdf.Dictionary new_fonts)
in in
{p with resources = new_resources}) {p with resources = new_resources})
(ilist 1 endpage)
(Pdfpage.pages_of_pagetree pdf) (Pdfpage.pages_of_pagetree pdf)
in in
Pdfpage.change_pages true pdf pages Pdfpage.change_pages true pdf pages