summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-10 21:04:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-10 21:04:05 +0000
commit144107d3ca6ddd2724a460c4da4a20e6e1b7f1b7 (patch)
tree7fc11c898c7d5397f8b910d447eccfd04680f288 /public
parent416cbeab1d93b1261dfb4584e0c8e47d9cd4720f (diff)
downloadpdfium-144107d3ca6ddd2724a460c4da4a20e6e1b7f1b7.tar.xz
Create API for adding content marks and setting their params.chromium/3488
This CL creates the following new functions in the public API: - FPDFPageObj_AddMark - FPDFPageObjMark_SetIntParam - FPDFPageObjMark_SetStringParam Bug: pdfium:1037 Change-Id: Icabf3fdd8e8153b9156bab807a3708d38a9365d8 Reviewed-on: https://pdfium-review.googlesource.com/37330 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'public')
-rw-r--r--public/fpdf_edit.h47
-rw-r--r--public/fpdfview.h2
2 files changed, 48 insertions, 1 deletions
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 380a0a236e..b85537d0b9 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -317,6 +317,19 @@ FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index);
// Experimental API.
+// Add a new content mark to a |page_object|.
+//
+// page_object - handle to a page object.
+// name - the name (tag) of the mark.
+//
+// Returns the handle to the content mark, or NULL on failure. The handle is
+// still owned by the library, and it should not be freed directly. It becomes
+// invalid if the page object is destroyed, either directly or indirectly by
+// unloading the page.
+FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
+FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name);
+
+// Experimental API.
// Get name of a content mark. |buffer| is only modified if |buflen| is longer
// than the length of the name.
//
@@ -441,6 +454,40 @@ FPDFPageObjMark_GetParamStringValueByKey(FPDF_PAGEOBJECTMARK mark,
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
+// a new parameter.
+//
+// document - handle to the document.
+// mark - handle to a content mark.
+// key - string key of the property.
+// value - int value to set.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ int value);
+
+// Experimental API.
+// Set the value of a string 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 - string value to set.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ FPDF_BYTESTRING value);
+
// 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.
diff --git a/public/fpdfview.h b/public/fpdfview.h
index de0421eb32..a35e34acc3 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -48,7 +48,7 @@ typedef struct fpdf_link_t__* FPDF_LINK;
typedef struct fpdf_page_t__* FPDF_PAGE;
typedef struct fpdf_pagelink_t__* FPDF_PAGELINK;
typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT; // (text, path, etc.)
-typedef const struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK;
+typedef struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK;
typedef const struct fpdf_pagerange_t__* FPDF_PAGERANGE;
typedef const struct fpdf_pathsegment_t* FPDF_PATHSEGMENT;
typedef void* FPDF_RECORDER; // Passed into skia.