From 144107d3ca6ddd2724a460c4da4a20e6e1b7f1b7 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 10 Jul 2018 21:04:05 +0000 Subject: Create API for adding content marks and setting their params. 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 Reviewed-by: Lei Zhang --- public/fpdf_edit.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ public/fpdfview.h | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'public') 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 @@ -316,6 +316,19 @@ FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object); 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. -- cgit v1.2.3