From ce4efd0bf3e1ce5aa85d3c1acf151fa74d468e58 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 30 Sep 2014 18:01:46 +0100 Subject: [PATCH] Beginning work on form xobjects squeeze --- cpdf.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpdf.ml b/cpdf.ml index 35250c5..1ddea61 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -66,7 +66,7 @@ let really_squeeze pdf = (* For a unknown reason, the output file is much smaller if Pdf.renumber is run twice. This is bizarre, since Pdf.renumber is an old, well-understood function in use for years -- what is - going on? *) + going on? Furthermore, if we run it 3 times, it gets bigger again! *) pdfr := Pdf.renumber changetable !pdfr; pdfr := Pdf.renumber changetable !pdfr; Pdf.remove_unreferenced !pdfr; @@ -74,6 +74,11 @@ let really_squeeze pdf = pdf.Pdf.objects <- !pdfr.Pdf.objects; pdf.Pdf.trailerdict <- !pdfr.Pdf.trailerdict +(* Squeeze the form xobject at objnum. Any resources from the page (or its +ancestors in the page tree!) are also needed - we must merge them with the +ones from the xobject itself. *) +let squeeze_form_xobjects page_resources pdf objnum = () + (* For each object in the PDF marked with /Type /Page, for each /Contents indirect reference or array of such, decode and recode that content stream. *) let squeeze_all_content_streams pdf =