Xobjects were being processed multiple times in squeeze

This commit is contained in:
John Whitington 2023-02-01 14:52:39 +00:00
parent 8ae103ade7
commit 214e3c3fa2

View File

@ -89,10 +89,12 @@ the page tree!) are also needed - we must merge them with the ones from the
xobject itself. However, it it safe for now -- in the unlikely event that the xobject itself. However, it it safe for now -- in the unlikely event that the
resources actually need to be available, the parse will fail, the squeeze of resources actually need to be available, the parse will fail, the squeeze of
this object will fail, and we bail out. *) this object will fail, and we bail out. *)
(* FIXME: XObjects inside xobjects? *)
let xobjects_done = ref [] let xobjects_done = ref []
let squeeze_form_xobject pdf objnum = let squeeze_form_xobject pdf objnum =
if mem objnum !xobjects_done then () else if mem objnum !xobjects_done then () else
begin
xobjects_done := objnum :: !xobjects_done; xobjects_done := objnum :: !xobjects_done;
let obj = Pdf.lookup_obj pdf objnum in let obj = Pdf.lookup_obj pdf objnum in
match Pdf.lookup_direct pdf "/Subtype" obj with match Pdf.lookup_direct pdf "/Subtype" obj with
@ -118,6 +120,7 @@ let squeeze_form_xobject pdf objnum =
| _ -> failwith "squeeze_form_xobject" | _ -> failwith "squeeze_form_xobject"
end end
| _ -> () | _ -> ()
end
(* For a list of indirects representing content streams, make sure that none of (* For a list of indirects representing content streams, make sure that none of
them are duplicated in the PDF. This indicates sharing, which parsing and them are duplicated in the PDF. This indicates sharing, which parsing and