diff options
author | Jane Liu <janeliulwq@google.com> | 2017-06-29 13:40:22 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-29 20:11:24 +0000 |
commit | 8ce58f522e046ae3b1561d592ca7b3cd7c894731 (patch) | |
tree | 571c245639b8321dae3c3a1254e317d59ee2b8bc /fpdfsdk/fpdfannot.cpp | |
parent | f1eae2c37cb4bbf7a536cf251706147bbac51880 (diff) | |
download | pdfium-8ce58f522e046ae3b1561d592ca7b3cd7c894731.tar.xz |
Added FPDFAnnot_RemoveAnnot()
Added an API for removing annotation and an embedder test for it.
Bug=pdfium:737
Change-Id: I6f01625e8103078b83967a57a5c1a7a26bc0c70a
Reviewed-on: https://pdfium-review.googlesource.com/7039
Commit-Queue: Jane Liu <janeliulwq@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r-- | fpdfsdk/fpdfannot.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp index 4a288b7df7..3d003d738e 100644 --- a/fpdfsdk/fpdfannot.cpp +++ b/fpdfsdk/fpdfannot.cpp @@ -201,6 +201,19 @@ DLLEXPORT void STDCALL FPDFPage_CloseAnnot(FPDF_ANNOTATION annot) { delete CPDFAnnotContextFromFPDFAnnotation(annot); } +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_RemoveAnnot(FPDF_PAGE page, int index) { + CPDF_Page* pPage = CPDFPageFromFPDFPage(page); + if (!pPage || !pPage->m_pFormDict || index < 0) + return false; + + CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots"); + if (!pAnnots || static_cast<size_t>(index) >= pAnnots->GetCount()) + return false; + + pAnnots->RemoveAt(index); + return true; +} + DLLEXPORT FPDF_ANNOTATION_SUBTYPE STDCALL FPDFAnnot_GetSubtype(FPDF_ANNOTATION annot) { if (!annot) |