summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
authorRalf Sippl <ralf.sippl@gmail.com>2018-03-14 15:18:55 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-14 15:18:55 +0000
commit2c3cfa734d034a0f0c78e658e98ed1113eba29a8 (patch)
tree530bd16b848f8b2fa0f7b7934880eb4b57698b57 /core/fpdfdoc/cpvt_generateap.cpp
parent7a1aa5f659110e99950b00b6b326b41436872635 (diff)
downloadpdfium-2c3cfa734d034a0f0c78e658e98ed1113eba29a8.tar.xz
Fix blend mode in generated AP
When adding an annotation, an appearance stream (AP) is generated. According to the PDF spec, the Subtype, Type and BM entries it contains should be names rather than strings. Type should be set to XObject. BUG=pdfium:1038 Change-Id: I0131eec33c257ab3a3a48c7e0dfeac5ca8dfbe2b Reviewed-on: https://pdfium-review.googlesource.com/28550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index a61a2451af..eb3e22d870 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -470,14 +470,14 @@ std::unique_ptr<CPDF_Dictionary> GenerateExtGStateDict(
const ByteString& sBlendMode) {
auto pGSDict =
pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool());
- pGSDict->SetNewFor<CPDF_String>("Type", "ExtGState", false);
+ pGSDict->SetNewFor<CPDF_Name>("Type", "ExtGState");
float fOpacity =
pAnnotDict.KeyExist("CA") ? pAnnotDict.GetNumberFor("CA") : 1;
pGSDict->SetNewFor<CPDF_Number>("CA", fOpacity);
pGSDict->SetNewFor<CPDF_Number>("ca", fOpacity);
pGSDict->SetNewFor<CPDF_Boolean>("AIS", false);
- pGSDict->SetNewFor<CPDF_String>("BM", sBlendMode, false);
+ pGSDict->SetNewFor<CPDF_Name>("BM", sBlendMode);
auto pExtGStateDict =
pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool());
@@ -514,7 +514,8 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
pStreamDict->SetNewFor<CPDF_Number>("FormType", 1);
- pStreamDict->SetNewFor<CPDF_String>("Subtype", "Form", false);
+ pStreamDict->SetNewFor<CPDF_Name>("Type", "XObject");
+ pStreamDict->SetNewFor<CPDF_Name>("Subtype", "Form");
pStreamDict->SetMatrixFor("Matrix", CFX_Matrix());
CFX_FloatRect rect = bIsTextMarkupAnnotation