diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-03-11 17:38:58 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-03-11 17:43:38 +0100 |
commit | 85884c363c21b90c025326d84428a23be024b1c9 (patch) | |
tree | 37c0bb19ec439732aba185b30457c4308c328d4a /libqpdf | |
parent | dc65b884573353fe5bc1ec1b06d6d92ac7faf814 (diff) | |
download | qpdf-85884c363c21b90c025326d84428a23be024b1c9.tar.zst |
Allow /DR to be direct in /AcroForm
Also handle direct annotation, though this is much less likely.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFAcroFormDocumentHelper.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index 0b3cc2ff..256fa694 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -947,8 +947,12 @@ QPDFAcroFormDocumentHelper::transformAnnotations( { if (from_acroform.getKey("/DR").isDictionary()) { - from_dr = this->qpdf.copyForeignObject( - from_acroform.getKey("/DR")); + from_dr = from_acroform.getKey("/DR"); + if (! from_dr.isIndirect()) + { + from_dr = from_qpdf->makeIndirectObject(from_dr); + } + from_dr = this->qpdf.copyForeignObject(from_dr); } if (from_acroform.getKey("/DA").isString()) { @@ -1105,6 +1109,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( // They will already be copied, so we'll get the right // object back. + // top_field and ffield_oh are known to be indirect. top_field = this->qpdf.copyForeignObject(top_field); ffield_oh = this->qpdf.copyForeignObject(ffield_oh); } @@ -1216,6 +1221,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations( } if (foreign) { + if (! annot.isIndirect()) + { + annot = from_qpdf->makeIndirectObject(annot); + } annot = this->qpdf.copyForeignObject(annot); } maybe_copy_object(annot); |