mirror of https://github.com/JakubMelka/PDF4QT.git
Stamp annotation intent (PDF 2.0)
This commit is contained in:
parent
ae311a31ae
commit
ab04fa66d8
|
@ -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")
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue