This commit is contained in:
John Whitington 2020-12-21 14:09:21 +00:00
parent 018ef019d8
commit dc90b27a39
1 changed files with 3 additions and 1 deletions

View File

@ -2884,7 +2884,8 @@ let rec extract_images_form_xobject pdf serial stem pnum form =
(* Remove any already in !written. Add any remaining to !written, if !args.dedup or !args.dedup_page *) (* Remove any already in !written. Add any remaining to !written, if !args.dedup or !args.dedup_page *)
let images = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Image")) xobjects in let images = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Image")) xobjects in
let already_written, images = List.partition (function Pdf.Indirect n -> mem n !written | _ -> false) images in let already_written, images = List.partition (function Pdf.Indirect n -> mem n !written | _ -> false) images in
written := (option_map (function Pdf.Indirect n -> Some n | _ -> None) images) @ !written; if args.dedup || args.dedup_per_page then
written := (option_map (function Pdf.Indirect n -> Some n | _ -> None) images) @ !written;
images images
in in
extract_images_inner serial pdf resources stem pnum images extract_images_inner serial pdf resources stem pnum images
@ -2908,6 +2909,7 @@ let extract_images pdf range stem =
in in
let images = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Image")) xobjects in let images = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Image")) xobjects in
let already_written, images = List.partition (function Pdf.Indirect n -> mem n !written | _ -> false) images in let already_written, images = List.partition (function Pdf.Indirect n -> mem n !written | _ -> false) images in
if args.dedup || args.dedup_per_page then
written := (option_map (function Pdf.Indirect n -> Some n | _ -> None) images) @ !written; written := (option_map (function Pdf.Indirect n -> Some n | _ -> None) images) @ !written;
let forms = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Form")) xobjects in let forms = keep (fun o -> Pdf.lookup_direct pdf "/Subtype" o = Some (Pdf.Name "/Form")) xobjects in
extract_images_inner serial pdf page.Pdfpage.resources stem pnum images; extract_images_inner serial pdf page.Pdfpage.resources stem pnum images;