Index: fpdfsdk/fpdfdoc.cpp |
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp |
index 7473cb06711dce26a731c5e17bf492862e1ad4e2..72c0f40d9eae833ad56c3f312658e28f7f047526 100644 |
--- a/fpdfsdk/fpdfdoc.cpp |
+++ b/fpdfsdk/fpdfdoc.cpp |
@@ -11,6 +11,8 @@ |
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
+#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" |
+#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
#include "fpdfsdk/include/fsdk_define.h" |
#include "third_party/base/stl_util.h" |
@@ -218,6 +220,27 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, |
return dest.GetPageIndex(pDoc); |
} |
+DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST pDict, |
+ FS_FLOAT* x, |
+ FS_FLOAT* y) { |
+ if (!pDict || !x || !y) |
+ return FALSE; |
+ |
+ CPDF_Array* dest = static_cast<CPDF_Array*>(pDict); |
+ if (dest->GetCount() < 4) |
+ return FALSE; |
+ |
+ const CPDF_Name* xyz = ToName(dest->GetDirectObjectAt(1)); |
+ const CPDF_Number* numX = ToNumber(dest->GetDirectObjectAt(2)); |
+ const CPDF_Number* numY = ToNumber(dest->GetDirectObjectAt(3)); |
+ if (!xyz || xyz->GetString() != "XYZ" || !numX || !numY) |
+ return FALSE; |
+ |
+ *x = numX->GetNumber(); |
+ *y = numY->GetNumber(); |
+ return TRUE; |
+} |
+ |
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, |
double x, |
double y) { |