diff --git a/PdfFile/SrcWriter/Annotation.cpp b/PdfFile/SrcWriter/Annotation.cpp index 59f2082aad..6872ed037c 100644 --- a/PdfFile/SrcWriter/Annotation.cpp +++ b/PdfFile/SrcWriter/Annotation.cpp @@ -1283,6 +1283,29 @@ namespace PdfWriter CStampAnnotation::CStampAnnotation(CXref* pXref) : CMarkupAnnotation(pXref, AnnotStamp), m_pAPStream(NULL) { } + CAnnotAppearanceObject* CStampAnnotation::StartAP(int nRotate) + { + CAnnotAppearanceObject* pNormal = CAnnotation::StartAP(nRotate); + CResourcesDict* pResources = dynamic_cast(pNormal->Get("Resources")); + + double dAlpha = 1; + CRealObject* pCA = dynamic_cast(Get("CA")); + if (pCA) + dAlpha = pCA->Get(); + if (dAlpha != 1) + { + CExtGrState* pExtGrState = m_pDocument->GetExtGState(dAlpha, dAlpha); + const char* sExtGrStateName = pResources->GetExtGrStateName(pExtGrState); + if (sExtGrStateName) + { + CStream* pStream = pNormal->GetStream(); + pStream->WriteEscapeName(sExtGrStateName); + pStream->WriteStr(" gs\012"); + } + } + + return pNormal; + } void CStampAnnotation::SetRotate(double nRotate) { Add("Rotate", nRotate); diff --git a/PdfFile/SrcWriter/Annotation.h b/PdfFile/SrcWriter/Annotation.h index 98a91dcf4f..3b5edfd762 100644 --- a/PdfFile/SrcWriter/Annotation.h +++ b/PdfFile/SrcWriter/Annotation.h @@ -426,6 +426,8 @@ namespace PdfWriter return AnnotStamp; } + virtual CAnnotAppearanceObject* StartAP(int nRotate) override; + void SetRotate(double nRotate); void SetName(const std::wstring& wsName); void SetAPStream(CDictObject* pStream, bool bCopy = false);