summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfdoc.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-01-04 11:54:18 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 19:45:11 +0000
commitde3f3fc5e16a2ee4fad2bdc0cda9e2ce73fd4fe3 (patch)
treedebf6885600821ca264fb69957258fdbf767bb43 /fpdfsdk/fpdfdoc.cpp
parentcb6c8d4ec4781c7db8448f2b4d9a8af879cf014e (diff)
downloadpdfium-de3f3fc5e16a2ee4fad2bdc0cda9e2ce73fd4fe3.tar.xz
Open FPDFDest_GetView API.
FPDFDest_GetView returns the view fit type and the parameters of the view for a given destination. This is useful to have more precise internal links and bookmarks that are able to manipulate the viewport position and zoom level to focus on the part of the PDF that it links to. Bug: 55776, 535978, 748852 Change-Id: Ibf7df40a852030d75ec78cec7662380319569850 Reviewed-on: https://pdfium-review.googlesource.com/21790 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfdoc.cpp')
-rw-r--r--fpdfsdk/fpdfdoc.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index 4d2942fb31..51a1c61e77 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -210,6 +210,30 @@ FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST pDict) {
return dest.GetPageIndex(pDoc);
}
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFDest_GetView(FPDF_DOCUMENT document,
+ FPDF_DEST pDict,
+ unsigned long* outNumParams,
+ FS_FLOAT* outParams) {
+ if (!pDict) {
+ *outNumParams = 0;
+ return 0;
+ }
+
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc) {
+ *outNumParams = 0;
+ return 0;
+ }
+
+ CPDF_Dest dest(static_cast<CPDF_Array*>(pDict));
+
+ *outNumParams = dest.GetNumParams();
+ for (unsigned long i = 0; i < *outNumParams; ++i)
+ outParams[i] = dest.GetParam(i);
+ return dest.GetZoomMode();
+}
+
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFDest_GetLocationInPage(FPDF_DEST pDict,
FPDF_BOOL* hasXVal,