From 2e1a32bc49f2b7b871cf0d04f25ec45b337f06fb Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Thu, 6 Jul 2017 12:01:25 -0400 Subject: Added APIs for getting/setting string pairs in annotation dictionaries 1. Added APIs for getting/setting arbitary key + value string pairs in annotation dictionaries. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: I93c9ca6fccf787028e106607ef8cf549ebca95d8 Reviewed-on: https://pdfium-review.googlesource.com/7150 Commit-Queue: Jane Liu Reviewed-by: dsinclair --- samples/pdfium_test.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 5a3668f6ce..5eccf22554 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -303,17 +303,21 @@ void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) { } // Retrieve the annotation's contents and author. + std::unique_ptr contents_key = + GetFPDFWideString(L"Contents"); unsigned long len = - FPDFAnnot_GetText(annot, FPDFANNOT_TEXTTYPE_Contents, nullptr, 0); + FPDFAnnot_GetStringValue(annot, contents_key.get(), nullptr, 0); std::vector buf(len); - FPDFAnnot_GetText(annot, FPDFANNOT_TEXTTYPE_Contents, buf.data(), len); + FPDFAnnot_GetStringValue(annot, contents_key.get(), buf.data(), len); fprintf(fp, "Content: %ls\n", GetPlatformWString(reinterpret_cast(buf.data())) .c_str()); - len = FPDFAnnot_GetText(annot, FPDFANNOT_TEXTTYPE_Author, nullptr, 0); + std::unique_ptr author_key = + GetFPDFWideString(L"T"); + len = FPDFAnnot_GetStringValue(annot, author_key.get(), nullptr, 0); buf.clear(); buf.resize(len); - FPDFAnnot_GetText(annot, FPDFANNOT_TEXTTYPE_Author, buf.data(), len); + FPDFAnnot_GetStringValue(annot, author_key.get(), buf.data(), len); fprintf(fp, "Author: %ls\n", GetPlatformWString(reinterpret_cast(buf.data())) .c_str()); -- cgit v1.2.3