From dc90b27a39c9165d974974c29bd103c0faf82bdf Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 21 Dec 2020 14:09:21 +0000 Subject: [PATCH] more --- cpdfcommand.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index e656125..d455520 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -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 *) 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 - 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 in extract_images_inner serial pdf resources stem pnum images @@ -2908,6 +2909,7 @@ let extract_images pdf range stem = 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 + if args.dedup || args.dedup_per_page then 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 extract_images_inner serial pdf page.Pdfpage.resources stem pnum images;