aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFPageDocumentHelper.hh6
-rw-r--r--include/qpdf/QPDFPageObjectHelper.hh13
2 files changed, 19 insertions, 0 deletions
diff --git a/include/qpdf/QPDFPageDocumentHelper.hh b/include/qpdf/QPDFPageDocumentHelper.hh
index d7d4a026..5847e078 100644
--- a/include/qpdf/QPDFPageDocumentHelper.hh
+++ b/include/qpdf/QPDFPageDocumentHelper.hh
@@ -52,6 +52,12 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
QPDF_DLL
void pushInheritedAttributesToPage();
+ // This calls QPDFPageObjectHelper::removeUnreferencedResources
+ // for every page in the document. See comments in
+ // QPDFPageObjectHelper.hh for details.
+ QPDF_DLL
+ void removeUnreferencedResources();
+
// Add new page at the beginning or the end of the current pdf.
// The newpage parameter may be either a direct object, an
// indirect object from this QPDF, or an indirect object from
diff --git a/include/qpdf/QPDFPageObjectHelper.hh b/include/qpdf/QPDFPageObjectHelper.hh
index 9226a748..570e81b4 100644
--- a/include/qpdf/QPDFPageObjectHelper.hh
+++ b/include/qpdf/QPDFPageObjectHelper.hh
@@ -122,6 +122,19 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
void addContentTokenFilter(
PointerHolder<QPDFObjectHandle::TokenFilter> token_filter);
+ // A page's resources dictionary maps names to objects elsewhere
+ // in the file. This method walks through a page's contents and
+ // keeps tracks of which resources are referenced somewhere in the
+ // contents. Then it removes from the resources dictionary any
+ // object that is not referenced in the contents. This operation
+ // is most useful after calling
+ // QPDFPageDocumentHelper::pushInheritedAttributesToPage(). This
+ // method is used by page splitting code to avoid copying unused
+ // objects in files that used shared resource dictionaries across
+ // multiple pages.
+ QPDF_DLL
+ void removeUnreferencedResources();
+
private:
class Members
{