aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r--libqpdf/QPDFObjectHandle.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index f26ee931..d0373d63 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -1235,6 +1235,25 @@ QPDFObjectHandle::unparseBinary()
}
}
+JSON
+QPDFObjectHandle::getJSON(bool dereference_indirect)
+{
+ if ((! dereference_indirect) && this->isIndirect())
+ {
+ return JSON::makeString(unparse());
+ }
+ else
+ {
+ if (this->m->reserved)
+ {
+ throw std::logic_error(
+ "QPDFObjectHandle: attempting to unparse a reserved object");
+ }
+ dereference();
+ return this->m->obj->getJSON();
+ }
+}
+
QPDFObjectHandle
QPDFObjectHandle::wrapInArray()
{