diff options
author | Jane Liu <janeliulwq@google.com> | 2017-07-18 10:15:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-19 13:55:30 +0000 |
commit | 18ae06d9ae493276b3ddcd37eb19de7aeba1a0e8 (patch) | |
tree | cfe59580602328796f2931506a591f2cf655c479 /fpdfsdk/fpdfview.cpp | |
parent | 0add284c1a2b3bee022bef34c7efddcb304f2e21 (diff) | |
download | pdfium-18ae06d9ae493276b3ddcd37eb19de7aeba1a0e8.tar.xz |
Basic APIs and tests for extracting attachments
1. Added API for extracting attachment properties and data.
* Expanded the embedder test to cover all the new APIs.
Bug=pdfium:174
Change-Id: I09bffd412410e9aea45faca442d2b72eefafef4e
Reviewed-on: https://pdfium-review.googlesource.com/7790
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 2e52ad6487..06e72b3a71 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -320,10 +320,30 @@ CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) { return static_cast<CPDF_PageObject*>(page_object); } +CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment) { + return static_cast<CPDF_Object*>(attachment); +} + +CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) { + return CFX_WideString::FromUTF16LE(wide_string, + CFX_WideString::WStringLength(wide_string)) + .UTF8Encode(); +} + CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap) { return static_cast<CFX_DIBitmap*>(bitmap); } +unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text, + void* buffer, + unsigned long buflen) { + CFX_ByteString encodedText = text.UTF16LE_Encode(); + unsigned long len = encodedText.GetLength(); + if (buffer && len <= buflen) + memcpy(buffer, encodedText.c_str(), len); + return len; +} + CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream( FPDF_FILEACCESS* pFileAccess) { return pdfium::MakeRetain<CPDF_CustomAccess>(pFileAccess); |