summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r--fpdfsdk/fpdfannot.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 5c4aae2075..ec748e66ec 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -727,6 +727,22 @@ FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot,
buffer, buflen);
}
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFAnnot_GetLinkedAnnot(FPDF_ANNOTATION annot, FPDF_WIDESTRING key) {
+ CPDF_AnnotContext* pAnnot = CPDFAnnotContextFromFPDFAnnotation(annot);
+ if (!pAnnot || !pAnnot->GetAnnotDict())
+ return nullptr;
+
+ CPDF_Dictionary* pLinkedDict =
+ pAnnot->GetAnnotDict()->GetDictFor(CFXByteStringFromFPDFWideString(key));
+ if (!pLinkedDict || pLinkedDict->GetStringFor("Type") != "Annot")
+ return nullptr;
+
+ auto pLinkedAnnot = pdfium::MakeUnique<CPDF_AnnotContext>(
+ pLinkedDict, pAnnot->GetPage(), nullptr);
+ return pLinkedAnnot.release();
+}
+
FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetFlags(FPDF_ANNOTATION annot) {
if (!annot)
return FPDF_ANNOT_FLAG_NONE;