summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_editpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_editpage.cpp')
-rw-r--r--fpdfsdk/fpdf_editpage.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 4df5505cca..02c07d1724 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -402,6 +402,9 @@ FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
void* buffer,
unsigned long buflen,
unsigned long* out_buflen) {
+ if (!out_buflen)
+ return false;
+
const CPDF_Dictionary* pParams = GetMarkParamDict(mark);
if (!pParams)
return false;
@@ -416,6 +419,33 @@ FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen) {
+ if (!out_buflen)
+ return false;
+
+ const CPDF_Dictionary* pParams = GetMarkParamDict(mark);
+ if (!pParams)
+ return false;
+
+ const CPDF_Object* pObj = pParams->GetObjectFor(key);
+ if (!pObj || !pObj->IsString())
+ return false;
+
+ ByteString result = pObj->GetString();
+ unsigned long len = result.GetLength();
+
+ if (buffer && len <= buflen)
+ memcpy(buffer, result.c_str(), len);
+
+ *out_buflen = len;
+ return true;
+}
+
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
if (!pageObject)
return false;
@@ -475,6 +505,24 @@ FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document,
return true;
}
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ void* value,
+ unsigned long value_len) {
+ CPDF_Dictionary* pParams = GetOrCreateMarkParamsDict(document, mark);
+ if (!pParams)
+ return false;
+
+ if (!value && value_len > 0)
+ return false;
+
+ pParams->SetNewFor<CPDF_String>(
+ key, ByteString(static_cast<const char*>(value), value_len), true);
+ return true;
+}
+
FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject) {
if (!pageObject)
return FPDF_PAGEOBJ_UNKNOWN;