summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp14
-rw-r--r--fpdfsdk/fpdf_editpage.cpp14
-rw-r--r--fpdfsdk/fpdf_view_c_api_test.c1
3 files changed, 29 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index ec6b893530..3da57ab737 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -484,6 +484,20 @@ TEST_F(FPDFEditEmbeddertest, RemoveMarkedObjectsPrime) {
} else if (name == L"GreaterThanTen") {
greater_than_ten_count++;
EXPECT_EQ(0, FPDFPageObjMark_CountParams(mark));
+ } else if (name == L"Bounds") {
+ EXPECT_EQ(1, FPDFPageObjMark_CountParams(mark));
+ ASSERT_GT(FPDFPageObjMark_GetParamKey(mark, 0, buffer, 256), 0u);
+ std::wstring key =
+ GetPlatformWString(reinterpret_cast<unsigned short*>(buffer));
+ EXPECT_EQ(L"Position", key);
+ EXPECT_EQ(FPDF_OBJECT_STRING,
+ FPDFPageObjMark_GetParamValueType(mark, 0));
+ ASSERT_GT(FPDFPageObjMark_GetParamStringValue(mark, 0, buffer, 256),
+ 0u);
+ std::wstring value =
+ GetPlatformWString(reinterpret_cast<unsigned short*>(buffer));
+ EXPECT_EQ(L"Last", value);
+ EXPECT_EQ(18, i);
} else {
FAIL();
}
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 241025f3a6..fc6b21f24c 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -339,6 +339,20 @@ FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark,
return param_pair->second->GetInteger();
}
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
+ unsigned long index,
+ void* buffer,
+ unsigned long buflen) {
+ auto* param_pair = GetMarkParamPairAtIndex(mark, index);
+ if (!param_pair)
+ return 0;
+
+ return Utf16EncodeMaybeCopyAndReturnLength(
+ WideString::FromUTF8(param_pair->second->GetString().AsStringView()),
+ buffer, buflen);
+}
+
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
if (!pageObject)
diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c
index dd93095550..792acbe439 100644
--- a/fpdfsdk/fpdf_view_c_api_test.c
+++ b/fpdfsdk/fpdf_view_c_api_test.c
@@ -152,6 +152,7 @@ int CheckPDFiumCApi() {
CHK(FPDFPageObjMark_GetParamKey);
CHK(FPDFPageObjMark_GetParamValueType);
CHK(FPDFPageObjMark_GetParamIntValue);
+ CHK(FPDFPageObjMark_GetParamStringValue);
CHK(FPDFImageObj_LoadJpegFile);
CHK(FPDFImageObj_LoadJpegFileInline);
CHK(FPDFImageObj_SetMatrix);