mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Stamp annotation intent (PDF 2.0)
This commit is contained in:
@ -491,7 +491,7 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
|
|||||||
PDFStampAnnotation* annotation = new PDFStampAnnotation();
|
PDFStampAnnotation* annotation = new PDFStampAnnotation();
|
||||||
result.reset(annotation);
|
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>{ "Approved", Stamp::Approved },
|
||||||
std::pair<const char*, Stamp>{ "AsIs", Stamp::AsIs },
|
std::pair<const char*, Stamp>{ "AsIs", Stamp::AsIs },
|
||||||
std::pair<const char*, Stamp>{ "Confidential", Stamp::Confidential },
|
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);
|
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")
|
else if (subtype == "Ink")
|
||||||
{
|
{
|
||||||
|
@ -1035,6 +1035,13 @@ enum class Stamp
|
|||||||
TopSecret
|
TopSecret
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class StampIntent
|
||||||
|
{
|
||||||
|
Stamp,
|
||||||
|
StampImage,
|
||||||
|
StampSnapshot
|
||||||
|
};
|
||||||
|
|
||||||
/// Annotation for stamps. Displays text or graphics intended to look
|
/// Annotation for stamps. Displays text or graphics intended to look
|
||||||
/// as if they were stamped on the paper.
|
/// as if they were stamped on the paper.
|
||||||
class PDFStampAnnotation : public PDFMarkupAnnotation
|
class PDFStampAnnotation : public PDFMarkupAnnotation
|
||||||
@ -1046,11 +1053,13 @@ public:
|
|||||||
virtual void draw(AnnotationDrawParameters& parameters) const override;
|
virtual void draw(AnnotationDrawParameters& parameters) const override;
|
||||||
|
|
||||||
Stamp getStamp() const { return m_stamp; }
|
Stamp getStamp() const { return m_stamp; }
|
||||||
|
StampIntent getIntent() const { return m_intent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend static PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
|
friend static PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
|
||||||
|
|
||||||
Stamp m_stamp = Stamp::Draft;
|
Stamp m_stamp = Stamp::Draft;
|
||||||
|
StampIntent m_intent = StampIntent::Stamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Ink annotation. Represents a path composed of disjoint polygons.
|
/// Ink annotation. Represents a path composed of disjoint polygons.
|
||||||
|
Reference in New Issue
Block a user