diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-25 12:55:31 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-26 04:30:05 +0100 |
commit | 009767d97a0dfebbb9bb71efb4b894b25fb59dd8 (patch) | |
tree | 6c10e6a67ecee41f511d06e88626f10bb737106a /libqpdf/QPDFObjectHandle.cc | |
parent | 2d32f4db8fd125f2481ecf767d9f6506e80481f6 (diff) | |
download | qpdf-009767d97a0dfebbb9bb71efb4b894b25fb59dd8.tar.zst |
Handle inheritable page attributes
Add getAttribute for handling inheritable page attributes, and fix
getPageImages and annotation flattening code to use it.
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index a0d45c86..b802a55c 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -18,6 +18,7 @@ #include <qpdf/Pl_QPDFTokenizer.hh> #include <qpdf/BufferInputSource.hh> #include <qpdf/QPDFExc.hh> +#include <qpdf/QPDFPageObjectHelper.hh> #include <qpdf/QTC.hh> #include <qpdf/QUtil.hh> @@ -1109,24 +1110,11 @@ QPDFObjectHandle::getGeneration() const std::map<std::string, QPDFObjectHandle> QPDFObjectHandle::getPageImages() { - // Note: this code doesn't handle inherited resources. If this - // page dictionary doesn't have a /Resources key or has one whose - // value is null or an empty dictionary, you are supposed to walk - // up the page tree until you find a /Resources dictionary. As of - // this writing, I don't have any test files that use inherited - // resources, and hand-generating one won't be a good test because - // any mistakes in my understanding would be present in both the - // code and the test file. - - // NOTE: If support of inherited resources (see above comment) is - // implemented, edit comment in QPDFObjectHandle.hh for this - // function. Also remove call to pushInheritedAttributesToPage - // from qpdf.cc when show_page_images is true. - std::map<std::string, QPDFObjectHandle> result; - if (this->hasKey("/Resources")) + QPDFObjectHandle resources = + QPDFPageObjectHelper(*this).getAttribute("/Resources", false); + if (resources.isDictionary()) { - QPDFObjectHandle resources = this->getKey("/Resources"); if (resources.hasKey("/XObject")) { QPDFObjectHandle xobject = resources.getKey("/XObject"); |