PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
annot.h
Go to the documentation of this file.
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CXX_PDF_ANNOT_H_INCLUDED_
4#define PDFSDK_CXX_PDF_ANNOT_H_INCLUDED_
5
10
11#include <pdfsdk/core/annots.h>
12#include <pdfsdk/cxx/math.h>
13
14#include "forward_declarations.h"
15#include "wrapper_base.h"
16
17namespace PDF {
18
24class Annot : public detail::RefCountedHandle<PDAnnot> {
25public:
31
37 bool Equals(const Annot& that) const;
38
49 PDAtom GetSubtype() const;
50
61 void SetFlags(PDAnnotFlags flags);
62
73 PDAnnotFlags GetFlags() const;
74
86 void SetRect(const PDF::RectF& rect);
87
100
105 void SetColor(PDColorValue color);
106
111 PDColorValue GetColor() const;
112
122 void SetContents(const std::wstring& contents);
123
133 std::wstring GetContents() const;
134
143 void SetModDate(const PDDateTime& date);
144
154
164 void SetBorder(const PDAnnotBorder& border);
165
176
187
197
204 bool IsVisibleInContext(OCContext context) const;
205
220 void SetAppearanceState(PDAtom appState);
221
236 PDAtom GetAppearanceState() const;
237
246 void SetFillOpacity(float opacity);
247
256 float GetFillOpacity() const;
257
266 void SetStrokeOpacity(float opacity);
267
276 float GetStrokeOpacity() const;
277
291 bool HasAppearance(PDAnnotState state, PDAtom appState) const;
292
297 std::wstring GetName() const;
298
303 void SetName(const std::wstring& name);
304
309 bool IsVisible() const;
310
315 void SetVisible(bool visible);
316
326
335 void SetBlendMode(PDEBlendMode blendMode);
336
353 void SetAppearance(PDAnnotState state, PDAtom appState, XObject app);
354
371 XObject GetAppearance(PDAnnotState state, PDAtom appState) const;
372
382
391 void SetLinkActions(const Action& actions);
392
402
411
420 void SetLinkQuadPoints(const QuadPoints& quadpoints);
421
431
441 void SetLinkBorderStyle(const PDAnnotBorderStyle& borderStyle);
442
452
462 void SetLinkDest(const Dest& dest);
463
472
479 bool IsMarkupAnnot() const;
480
489 void SetMarkupTitle(const std::wstring& title);
490
498 std::wstring GetMarkupTitle() const;
499
509 Annot GetMarkupPopup() const;
510
519 void SetMarkupPopup(Annot popup);
520
529 void SetMarkupRichContents(const std::wstring& contents);
530
538 std::wstring GetMarkupRichContents() const;
539
548
557
565 void SetMarkupSubject(const std::wstring& subject);
566
574 std::wstring GetMarkupSubject() const;
575
584 void SetMarkupInReplyTo(const Annot& inReplyTo);
585
590 Annot GetMarkupInReplyTo() const;
591
601
611
620 void SetMarkupIntent(PDAtom intent);
621
630 PDAtom GetMarkupIntent() const;
631
640 void SetTextOpen(bool open);
641
650 bool IsTextOpen() const;
651
658 void SetTextIconName(PDAtom iconName);
659
666 PDAtom GetTextIconName() const;
667
674 void SetTextState(const std::wstring& state);
675
682 std::wstring GetTextState() const;
683
690 void SetTextStateModel(const std::wstring& stateModel);
691
698 std::wstring GetTextStateModel() const;
699
710
721
731 std::vector<std::vector<PointF>> GetInkPointsList() const;
732
742 void SetInkPointsList(const std::vector<std::vector<PointF>>& pointslist);
743
755
767
778
789
796 PDColorValue GetWidgetBorderColor() const;
797
804 void SetWidgetBorderColor(PDColorValue color);
805
812 PDColorValue GetWidgetBackgroundColor() const;
813
820 void SetWidgetBackgroundColor(PDColorValue color);
821
827
832 void SetWidgetFont(const Font& font);
833
840 float GetWidgetFontSize() const;
841
848 void SetWidgetFontSize(float fontSize);
849
854 PDColorValue GetWidgetFontColor() const;
855
860 void SetWidgetFontColor(PDColorValue color);
861
870
879
888
897
906
916
926
936
946
952
957 void SetFreeTextFont(const Font& font);
958
967 PDColorValue GetFreeTextFontColor() const;
968
977 void SetFreeTextFontColor(PDColorValue fontColor);
978
986 PDColorValue GetFreeTextBorderColor() const;
987
995 void SetFreeTextBorderColor(PDColorValue borderColor);
996
1005 float GetFreeTextFontSize() const;
1006
1015 void SetFreeTextFontSize(float fontSize);
1016
1026
1035 void SetFreeTextLineEnding(PDAtom endPointStyle);
1036
1047
1057 void SetFreeTextRectDifferences(const RectF& differences);
1058
1064 size_t HitTestFreeTextChar(const PointF& pagePt) const;
1065
1074 Quad GetFreeTextCharQuad(size_t index) const;
1075
1080 size_t GetFreeTextNumLines() const;
1081
1087
1092 void SetFreeTextLineSpacing(float lineSpacing);
1093
1101
1108 void SetFreeTextCharSpacing(float charSpacing);
1109
1115 size_t GetFreeTextFirstCharOnLine(size_t lineIndex) const;
1116
1122 size_t GetFreeTextLineWithChar(size_t charIndex) const;
1123
1129
1135
1141
1148 void SetFileAttachmentIconName(PDAtom iconName);
1149
1150 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Annot, PDAnnot)
1151};
1152
1153} // namespace PDF
1154
1155#include "annot_impl.inl"
1156
1157#endif // PDFSDK_CXX_PDF_ANNOT_H_INCLUDED_
Annotations API.
PDAnnotState
Defines visual appearance of an annotation at different times based on user interaction.
Definition annots.h:68
PDMarkupAnnotReplyType
Defines the relationship between markup annotations.
Definition annots.h:157
PDQuadding
Defines the alignment of text for a free text annotation.
Definition annots.h:138
Represents an action in a PDF document.
Definition action.h:32
PDQuadding GetFreeTextQuadding() const
Get the text alignment of the free text annotation.
bool IsVisibleInContext(OCContext context) const
Check if an annotation is visible in a given optional content (OC) context.
void SetWidgetBackgroundColor(PDColorValue color)
Set the background color of the widget annotation.
void SetFreeTextFont(const Font &font)
Set the font information of the free text annotation.
PDAnnotBorder GetBorder() const
Get the border of this annotation.
void SetWidgetFont(const Font &font)
Set the font information of the widget annotation.
void SetFreeTextRectDifferences(const RectF &differences)
Set the differences in rectangle coordinates between the annotation rectangle and text rectangle with...
void SetFreeTextQuadding(PDQuadding quadding)
Set the text alignment of the free text annotation.
void SetTextMarkupQuadPoints(const QuadPoints &quads)
Set the quad points of the text markup annotation.
void SetFreeTextRotate(PDRotate rotate)
Set the rotation angle of the free text annotation.
bool IsVisible() const
Check if this annotation is visible.
QuadPoints GetLinkQuadPoints() const
Get the link quad points of this annotation.
void SetWidgetFontColor(PDColorValue color)
Set the font color of the widget annotation.
PDAtom GetAppearanceState() const
Get the appearance state of this annotation.
void SetLinkDest(const Dest &dest)
Set the link destination of this annotation.
PDAtom GetTextIconName() const
Get the icon name of the text annotation. For more information refer to ISO 32000-2:2020 (PDF 2....
PDRotate GetFreeTextRotate() const
Get the rotation angle of the free text annotation.
void SetModDate(const PDDateTime &date)
Set the modification date of this annotation.
void SetFileAttachmentIconName(PDAtom iconName)
Set the icon name of the file attachment annotation. For more information refer to ISO 32000-2:2020 (...
void SetMarkupSubject(const std::wstring &subject)
Set the subject of the markup annotation.
PDAtom GetSubtype() const
Get the subtype of this annotation.
void SetMarkupCreationDate(const PDDateTime &date)
Set the creation date of the markup annotation.
void SetLinkBorderStyle(const PDAnnotBorderStyle &borderStyle)
Set the border style for a link annotation.
std::wstring GetContents() const
Get the contents of this annotation.
void SetContents(const std::wstring &contents)
Set the contents of this annotation.
PDAtom GetFreeTextLineEnding() const
Get the callout line ending style of the free text annotation.
PDColorValue GetFreeTextBorderColor() const
Get the border color of the free text annotation.
PDColorValue GetColor() const
Get the color of this annotation.
std::wstring GetMarkupSubject() const
Get the subject of the markup annotation.
void SetFreeTextBorderStyle(const PDAnnotBorderStyle &borderStyle)
Set the border style of the free text annotation.
void SetFileAttachmentFileSpec(const FileSpec &fileSpec)
Set the file specification of the file attachment annotation.
void SetFreeTextFontColor(PDColorValue fontColor)
Set the font color of the free text annotation.
Annot GetMarkupPopup() const
Get the popup annotation associated with the markup annotation.
Action GetLinkActions() const
Get the link actions associated with this annotation.
RectF GetFreeTextRectDifferences() const
Get the differences in rectangle coordinates between the annotation rectangle and text rectangle with...
PDColorValue GetWidgetBackgroundColor() const
Get the background color of the widget annotation.
void RemoveLinkActions()
Remove all link actions associated with this annotation.
void SetMarkupIntent(PDAtom intent)
Set the intent of the markup annotation.
PDDateTime GetModDate() const
Get the latest modification date of this annotation.
QuadPoints GetTextMarkupQuadPoints() const
Get the quad points of the text markup annotation.
std::wstring GetName() const
Get the name for an annotation.
void SetInkPointsList(const std::vector< std::vector< PointF > > &pointslist)
Set the list of ink points of the ink annotation.
void SetFreeTextBorderEffect(const PDAnnotBorderEffect &borderEffect)
Set the border effect of the free text annotation.
float GetStrokeOpacity() const
Get the stroke opacity of this annotation.
void SetTextStateModel(const std::wstring &stateModel)
Set the text state model of the text annotation. For more information refer to to ISO 32000-2:2020 (P...
size_t GetFreeTextNumLines() const
Get the number of lines contained in the free text annotation.
void SetFreeTextLineSpacing(float lineSpacing)
Set the line spacing of the free text annotation.
XObject GetAppearance(PDAnnotState state, PDAtom appState) const
Get the appearance graphics object (XObject) of this annotation for the given state and appearance st...
void SetWidgetFontSize(float fontSize)
Set the font size of the widget annotation.
size_t GetFreeTextFirstCharOnLine(size_t lineIndex) const
Get the index of the first character on the specified line in the free text annotation.
void SetBorder(const PDAnnotBorder &border)
Sets the border for an annotation.
void SetWidgetBorderStyle(PDAnnotBorderStyle borderStyle)
Set the border style of the widget annotation.
float GetFreeTextCharSpacing() const
Get the character spacing for the free text annotation.
PDColorValue GetWidgetFontColor() const
Get the font color of the widget annotation.
void SetMarkupPopup(Annot popup)
Set a popup annotation associated with the markup annotation.
void SetTextIconName(PDAtom iconName)
Set the icon name of the text annotation. For more information refer to ISO 32000-2:2020 (PDF 2....
std::wstring GetTextStateModel() const
Get the text state model of the text annotation. For more information refer to to ISO 32000-2:2020 (P...
void SetAppearance(PDAnnotState state, PDAtom appState, XObject app)
Set the appearance for an annotation for the given state and appearance state.
void SetVisible(bool visible)
Set the visibility of this annotation.
size_t GetFreeTextLineWithChar(size_t charIndex) const
Get the index of the line containing the specified character for a free text annotation.
PDMarkupAnnotReplyType GetMarkupReplyType() const
Get the reply type of the markup annotation.
PDF::RectF GetRect() const
Get the rectangle of this annotation.
void SetFreeTextCharSpacing(float charSpacing)
Set the character spacing of the free text annotation.
PDAnnotBorderStyle GetLinkBorderStyle() const
Get the link border style of this annotation.
void SetLinkActions(const Action &actions)
Set the link actions of this annotation.
Annot GetMarkupInReplyTo() const
Get the annotation that this markup annotation is in reply to.
PDAnnotBorderStyle GetWidgetBorderStyle() const
Get the border style of the widget annotation.
void SetFlags(PDAnnotFlags flags)
Set the flags of this annotation.
PDAnnotFlags GetFlags() const
Get the flags of this annotation.
void SetTextOpen(bool open)
Set the open state of the text or popup annotation (having a parent markup annotation).
float GetFillOpacity() const
Get the fill opacity of an annotation.
PDColorValue GetWidgetBorderColor() const
Get the border color of the widget annotation.
FormField GetWidgetParent() const
Get the parent form field of the widget annotation.
PDAtom GetFileAttachmentIconName() const
Get the icon name of the file attachment annotation.
PDRotate GetWidgetRotate() const
Get the rotation angle of the widget annotation.
bool Equals(const Annot &that) const
Check if this annotation is equal to another annotation.
PDDateTime GetMarkupCreationDate() const
Get the creation date of the markup annotation.
void SetStrokeOpacity(float opacity)
Set the stroke opacity of this annotation.
bool IsTextOpen() const
Check if the text or popup annotation is set to be shown.
float GetFreeTextLineSpacing() const
Get the line spacing of the free text annotation.
std::vector< std::vector< PointF > > GetInkPointsList() const
Get the list of ink points of the ink annotation.
void SetName(const std::wstring &name)
Set the name for an annotation.
Dest GetLinkDest() const
Get the link destination of this annotation.
void SetAppearanceState(PDAtom appState)
Set the appearance state for an annotation.
PDColorValue GetFreeTextFontColor() const
Get the font color of the free text annotation.
OCMembership GetOCMD() const
Get the optional content (OC) membership dictionary of this annotation.
void SetFillOpacity(float opacity)
Set the fill opacity of an annotation.
void SetRect(const PDF::RectF &rect)
Set the rectangle of this annotation.
void SetWidgetRotate(PDRotate rotate)
Set the rotation angle of the widget annotation.
void SetLinkQuadPoints(const QuadPoints &quadpoints)
Set the link quad points of this annotation.
std::wstring GetMarkupRichContents() const
Get the rich contents of a markup annotation.
Font GetFreeTextFont() const
Get the font information of the free text annotation.
void SetMarkupReplyType(PDMarkupAnnotReplyType replyType)
Set the reply type for a markup annotation.
size_t HitTestFreeTextChar(const PointF &pagePt) const
Perform a hit test to determine which character in the free text annotation is at the specified point...
PDAtom GetMarkupIntent() const
Get the intent of the markup annotation.
Font GetWidgetFont() const
Get the font information of the widget annotation.
Object GetPdfObject() const
Get the PDF object associated with this annotation.
void SetFreeTextFontSize(float fontSize)
Set the font size of the free text annotation.
void SetMarkupTitle(const std::wstring &title)
Set the title of the markup annotation.
float GetWidgetFontSize() const
Get the font size of the widget annotation.
bool HasAppearance(PDAnnotState state, PDAtom appState) const
Check if an annotation has an appearance state defined for one of the three states (Normal,...
void SetTextState(const std::wstring &state)
Set the text state of the text annotation. For more information refer to to ISO 32000-2:2020 (PDF 2....
void SetColor(PDColorValue color)
Set the color of this annotation.
void SetOCMD(OCMembership ocmd)
Set the optional content (OC) membership dictionary for this annotation.
PDEBlendMode GetBlendMode() const
Get the blend mode of this annotation.
Quad GetFreeTextCharQuad(size_t index) const
Get the quad representing the bounding box of the character at the specified index in the free text a...
void SetMarkupInReplyTo(const Annot &inReplyTo)
Set the in reply to (IRT) for a markup annotation.
void SetWidgetBorderColor(PDColorValue color)
Set the border color of the widget annotation.
void UpdateAppearance()
Update appearance of this annotation.
float GetFreeTextFontSize() const
Get the font size of the free text annotation.
void SetBlendMode(PDEBlendMode blendMode)
Set the blend mode of this annotation.
void SetFreeTextBorderColor(PDColorValue borderColor)
Set the border color of the free text annotation.
FileSpec GetFileAttachmentFileSpec() const
Get the file specification of the file attachment annotation.
PDAnnotBorderEffect GetFreeTextBorderEffect() const
Get the border effect of the free text annotation.
std::wstring GetMarkupTitle() const
Get the title of the markup annotation.
void SetMarkupRichContents(const std::wstring &contents)
Set the rich contents of a markup annotation.
void SetFreeTextLineEnding(PDAtom endPointStyle)
Set the line ending style of the free text annotation.
bool IsMarkupAnnot() const
Check if this annotation is a markup annotation.
PDAnnotBorderStyle GetFreeTextBorderStyle() const
Get the border style of the free text annotation.
std::wstring GetTextState() const
Get the text state of the text annotation. For more information refer to to ISO 32000-2:2020 (PDF 2....
Represents a destination in a PDF document.
Definition dest.h:31
Specifies an external file which is referred to inside a PDF document.
Definition filespec.h:29
Represents a font in a PDF document.
Definition font.h:30
Represents a form field in a PDF document.
Definition form_field.h:224
A runtime optional-content visibility context for a document.
Definition optional_content.h:288
Optional content membership dictionary (OCMD).
Definition optional_content.h:96
Represents a PDF object.
Definition object.h:25
Represents an XObject in a PDF document.
Definition xobject.h:22
PDEBlendMode
Specifies the type of function/mode used to determine how new content interacts with existing content...
Definition content.h:93
Definition annots.h:124
Definition annots.h:78
Definition annots.h:104
Definition types.h:23
Definition math.h:154
Definition math.h:1033
Definition math.h:1200
Definition math.h:752
PDRotate
Specifies degrees of rotation.
Definition types.h:38