Stamp annotation intent (PDF 2.0)

This commit is contained in:
Jakub Melka 2020-08-30 18:03:07 +02:00
parent ae311a31ae
commit ab04fa66d8
2 changed files with 18 additions and 1 deletions

View File

@ -491,7 +491,7 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
PDFStampAnnotation* annotation = new PDFStampAnnotation();
result.reset(annotation);
constexpr const std::array<std::pair<const char*, Stamp>, 14> stamps = {
constexpr const std::array stamps = {
std::pair<const char*, Stamp>{ "Approved", Stamp::Approved },
std::pair<const char*, Stamp>{ "AsIs", Stamp::AsIs },
std::pair<const char*, Stamp>{ "Confidential", Stamp::Confidential },
@ -509,6 +509,14 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
};
annotation->m_stamp = loader.readEnumByName(dictionary->get("Name"), stamps.begin(), stamps.end(), Stamp::Draft);
constexpr const std::array stampsIntents = {
std::pair<const char*, StampIntent>{ "Stamp", StampIntent::Stamp },
std::pair<const char*, StampIntent>{ "StampImage", StampIntent::StampImage },
std::pair<const char*, StampIntent>{ "StampSnapshot", StampIntent::StampSnapshot },
};
annotation->m_intent = loader.readEnumByName(dictionary->get("IT"), stampsIntents.begin(), stampsIntents.end(), StampIntent::Stamp);
}
else if (subtype == "Ink")
{

View File

@ -1035,6 +1035,13 @@ enum class Stamp
TopSecret
};
enum class StampIntent
{
Stamp,
StampImage,
StampSnapshot
};
/// Annotation for stamps. Displays text or graphics intended to look
/// as if they were stamped on the paper.
class PDFStampAnnotation : public PDFMarkupAnnotation
@ -1046,11 +1053,13 @@ public:
virtual void draw(AnnotationDrawParameters& parameters) const override;
Stamp getStamp() const { return m_stamp; }
StampIntent getIntent() const { return m_intent; }
private:
friend static PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
Stamp m_stamp = Stamp::Draft;
StampIntent m_intent = StampIntent::Stamp;
};
/// Ink annotation. Represents a path composed of disjoint polygons.