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

Unified Diff: fpdfsdk/fpdfview.cpp

Issue 2475923003: Implement FPDF_VIEWERREF_GetName() API. (Closed)
Patch Set: Comment Created 4 years, 1 month 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 | « core/fpdfdoc/cpdf_viewerpreferences.cpp ('k') | fpdfsdk/fpdfview_c_api_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfview.cpp
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index cde15dff9bdc3861e35df033ebd3d32e13ca9cb8..9142dc78c9352f91cfc8f41c8ae6ddb84f43d247 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -942,6 +942,25 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
return DuplexUndefined;
}
+DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING key,
+ char* buffer,
+ unsigned long length) {
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return 0;
+
+ CPDF_ViewerPreferences viewRef(pDoc);
+ CFX_ByteString bsVal;
+ if (!viewRef.GenericName(key, &bsVal))
+ return 0;
+
+ unsigned long dwStringLen = bsVal.GetLength() + 1;
+ if (buffer && length >= dwStringLen)
+ memcpy(buffer, bsVal.c_str(), dwStringLen);
+ return dwStringLen;
+}
+
DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
« no previous file with comments | « core/fpdfdoc/cpdf_viewerpreferences.cpp ('k') | fpdfsdk/fpdfview_c_api_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698