summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_string.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_string.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 06bae54916..01cf3ff1b0 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -64,3 +64,14 @@ const CPDF_String* CPDF_String::AsString() const {
CFX_WideString CPDF_String::GetUnicodeText() const {
return PDF_DecodeText(m_String);
}
+
+bool CPDF_String::WriteTo(CFX_FileBufferArchive* archive,
+ FX_FILESIZE* offset) const {
+ CFX_ByteString str = GetString();
+ int32_t len =
+ archive->AppendString(PDF_EncodeString(str, IsHex()).AsStringC());
+ if (len < 0)
+ return false;
+ *offset += len;
+ return true;
+}