Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2210)

Unified Diff: fpdfsdk/fpdfdoc.cpp

Issue 1960193003: pdfium_test: print out some annotations Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 2016-05-20 (Friday) 20:39:39 EDT Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | public/fpdf_doc.h » ('j') | public/fpdf_doc.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | public/fpdf_doc.h » ('j') | public/fpdf_doc.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698