diff options
author | Jane Liu <janeliulwq@google.com> | 2017-07-06 12:01:25 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-06 17:11:48 +0000 |
commit | 2e1a32bc49f2b7b871cf0d04f25ec45b337f06fb (patch) | |
tree | bbdadb63a74dab598f7990a7aa296eb71f8a99da /samples | |
parent | 3656774aa2b654f3c26c188c45a1d284962e9c43 (diff) | |
download | pdfium-2e1a32bc49f2b7b871cf0d04f25ec45b337f06fb.tar.xz |
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 <janeliulwq@google.com>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/pdfium_test.cc | 12 |
1 files changed, 8 insertions, 4 deletions
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<unsigned short, pdfium::FreeDeleter> 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<char> 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<unsigned short*>(buf.data())) .c_str()); - len = FPDFAnnot_GetText(annot, FPDFANNOT_TEXTTYPE_Author, nullptr, 0); + std::unique_ptr<unsigned short, pdfium::FreeDeleter> 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<unsigned short*>(buf.data())) .c_str()); |