//--------------------------------------------------------------------------------------- // Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved. // Consult legal.txt regarding legal and license information. //--------------------------------------------------------------------------------------- #ifndef PDFTRON_H_CPPPDFAnnotsText #define PDFTRON_H_CPPPDFAnnotsText #include namespace pdftron { namespace PDF { namespace Annots { /** * A text annotation represents a "sticky note" attached to a point in * the PDF document. When closed, the annotation shall appear as an icon; * when open, it shall display a pop-up window containing the text of * the note in a font and size chosen by the conforming reader. * Text annotations do not scale and rotate with the page (i.e. they should * behave as if the NoZoom and NoRotate annotation flags). */ class Text : public Markup { public: /** * Creates a Text annotation and initializes it using given Cos/SDF object. * @param d The Cos/SDF object to initialze the annotation with. * @note The constructor does not copy any data, but is instead the logical * equivalent of a type cast. */ Text(SDF::Obj d = 0); /** * Creates a Text annotation and initializes it using given annotation object. * @param ann Annot object used to initialize the Text annotation. * @note The constructor does not copy any data, but is instead the logical * equivalent of a type cast. */ Text(const Annot& ann) : Markup(ann.GetSDFObj()) {} /** * Creates a new Text annotation in the specified document. * * @param doc A document to which the annotation is added. * @param pos A rectangle specifying the annotation's bounds in default user space units. * * @return A newly created blank Text annotation. */ //static Text Create(SDF::SDFDoc& doc, const Rect& pos); /** * Creates a new Text annotation in the specified document. * * @param doc A document to which the annotation is added. * @param pos A rectangle specifying the annotation's bounds in default user space units. * @param contents The text of the annotation, that shall be displayed in its popup window. * * @return A newly created Text annotation. */ static Text Create(SDF::SDFDoc& doc, const Rect& pos, const UString& contents = UString("") ); static Text CreateAnnot(SDF::SDFDoc& doc, const Rect& pos, const UString& contents = UString("") ); /** * Creates a new Text annotation in the specified document. * * @param doc A document to which the annotation is added. * @param pos A point specifying the annotation's location in default user space units. * This determines the location of bottom left corner of the annotation's icon. * @param contents The text of the annotation, that shall be displayed in its popup window. * * @return A newly created Text annotation. */ static Text Create(SDF::SDFDoc& doc, const Point& pos, const UString& contents = UString("") ); static Text CreateAnnot(SDF::SDFDoc& doc, const Point& pos, const UString& contents = UString("") ); /** * Returns the initial status of the Text annotation. * * @return A boolean value that specifies whether the annotation shall * initially be displayed as opened. * Default value: false. */ bool IsOpen() const; /** * Sets the initial status of the Text annotation. * (Optional) * * @param isopen A boolean value that specifies whether the annotation shall * initially be displayed as opened. * Default value: false. */ void SetOpen(bool isopen); /** * Icon enumeration defines the type of icon * associated with the Text annotation. * */ enum Icon { e_Comment, /// #endif // PDFTRON_H_CPPPDFAnnotsText