This commit is contained in:
John Whitington 2023-05-07 17:09:08 +01:00
parent d4388d1b78
commit 60c191e60b
1 changed files with 11 additions and 7 deletions

View File

@ -268,13 +268,17 @@ let draw_single ~filename ~bates ~batespad fast range pdf drawops =
let new_gss = update gss_resources (read_resource pdf "/ExtGState" p) in let new_gss = update gss_resources (read_resource pdf "/ExtGState" p) in
let new_xobjects = update (select_resources res.form_xobjects @ select_resources res.images) (read_resource pdf "/XObject" p) in let new_xobjects = update (select_resources res.form_xobjects @ select_resources res.images) (read_resource pdf "/XObject" p) in
let new_fonts = update (select_resources res.fonts) (read_resource pdf "/Font" p) in let new_fonts = update (select_resources res.fonts) (read_resource pdf "/Font" p) in
Pdf.add_dict_entry let add_if_non_empty dict name newdict =
(Pdf.add_dict_entry if newdict = Pdf.Dictionary [] then dict else
(Pdf.add_dict_entry p.Pdfpage.resources "/XObject" (Pdf.Dictionary new_xobjects)) Pdf.add_dict_entry dict name newdict
"/ExtGState" in
(Pdf.Dictionary new_gss)) add_if_non_empty
"/Font" (add_if_non_empty
(Pdf.Dictionary new_fonts) (add_if_non_empty p.Pdfpage.resources "/XObject" (Pdf.Dictionary new_xobjects))
"/ExtGState"
(Pdf.Dictionary new_gss))
"/Font"
(Pdf.Dictionary new_fonts)
in in
{p with resources = new_resources}) {p with resources = new_resources})
(Pdfpage.pages_of_pagetree pdf) (Pdfpage.pages_of_pagetree pdf)