From 07520f6e9cfd1c1f304d18af614d83938e382adb Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Thu, 12 Jul 2018 19:45:29 +0000 Subject: Create API to set and get blob values from a mark dict. The new functions are: - FPDFPageObjMark_GetParamBlobValue - FPDFPageObjMark_SetBlobParam Bug: pdfium:1037 Change-Id: Ie04df04c64c6cf517a8cde182d7e9a38c3c78d1b Reviewed-on: https://pdfium-review.googlesource.com/37570 Commit-Queue: Henrique Nakashima Reviewed-by: Lei Zhang --- public/fpdf_edit.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h index e7f6cc4a70..677bce80b1 100644 --- a/public/fpdf_edit.h +++ b/public/fpdf_edit.h @@ -407,7 +407,7 @@ FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark, // out_buflen - pointer to variable that will receive the length of the value. // Not filled if false is returned. // -// Returns TRUE if the key maps to a string value, FALSE otherwise. +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, FPDF_BYTESTRING key, @@ -415,6 +415,26 @@ FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, unsigned long buflen, unsigned long* out_buflen); +// Experimental API. +// Get the value of a blob property in a content mark by key. +// |buffer| is only modified if |buflen| is longer than or equal to the length +// of the value. +// +// mark - handle to a content mark. +// key - string key of the property. +// buffer - buffer for holding the returned value. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the length of the value. +// Not filled if false is returned. +// +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + // Experimental API. // Set the value of an int property in a content mark by key. If a parameter // with key |key| exists, its value is set to |value|. Otherwise, it is added as @@ -449,6 +469,25 @@ FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document, FPDF_BYTESTRING key, FPDF_BYTESTRING value); +// Experimental API. +// Set the value of a blob property in a content mark by key. If a parameter +// with key |key| exists, its value is set to |value|. Otherwise, it is added as +// a new parameter. +// +// document - handle to the document. +// mark - handle to a content mark. +// key - string key of the property. +// value - pointer to blob value to set. +// value_len - size in bytes of |value|. +// +// Returns TRUE if the operation succeeded, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document, + FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* value, + unsigned long value_len); + // Load an image from a JPEG image file and then set it into |image_object|. // // pages - pointer to the start of all loaded pages, may be NULL. -- cgit v1.2.3