PoDoFo  0.9.6
Public Member Functions | List of all members
PoDoFo::PdfAnnotation Class Reference

#include <PdfAnnotation.h>

Inheritance diagram for PoDoFo::PdfAnnotation:
PoDoFo::PdfElement

Public Member Functions

 PdfAnnotation (PdfPage *pPage, EPdfAnnotation eAnnot, const PdfRect &rRect, PdfVecObjects *pParent)
 
 PdfAnnotation (PdfObject *pObject, PdfPage *pPage)
 
void SetAppearanceStream (PdfXObject *pObject, EPdfAnnotationAppearance eAppearance=ePdfAnnotationAppearance_Normal, const PdfName &state="")
 
bool HasAppearanceStream () const
 
PdfRect GetRect () const
 
void SetRect (const PdfRect &rRect)
 
void SetFlags (pdf_uint32 uiFlags)
 
pdf_uint32 GetFlags () const
 
void SetBorderStyle (double dHCorner, double dVCorner, double dWidth)
 
void SetBorderStyle (double dHCorner, double dVCorner, double dWidth, const PdfArray &rStrokeStyle)
 
void SetTitle (const PdfString &sTitle)
 
PdfString GetTitle () const
 
void SetContents (const PdfString &sContents)
 
PdfString GetContents () const
 
void SetDestination (const PdfDestination &rDestination)
 
PdfDestination GetDestination (PdfDocument *pDoc) const
 
bool HasDestination () const
 
void SetAction (const PdfAction &rAction)
 
PdfActionGetAction () const
 
bool HasAction () const
 
void SetOpen (bool b)
 
bool GetOpen () const
 
bool HasFileAttachement () const
 
void SetFileAttachement (const PdfFileSpec &rFileSpec)
 
PdfFileSpecGetFileAttachement () const
 
PdfArray GetQuadPoints () const
 
void SetQuadPoints (const PdfArray &rQuadPoints)
 
PdfArray GetColor () const
 
void SetColor (double r, double g, double b)
 
void SetColor (double c, double m, double y, double k)
 
void SetColor (double gray)
 
void SetColor ()
 
EPdfAnnotation GetType () const
 
PdfPageGetPage () const
 
- Public Member Functions inherited from PoDoFo::PdfElement
PdfObjectGetObject ()
 
const PdfObjectGetObject () const
 

Additional Inherited Members

- Protected Member Functions inherited from PoDoFo::PdfElement
 PdfElement (const char *pszType, PdfVecObjects *pParent)
 
 PdfElement (const char *pszType, PdfDocument *pParent)
 
 PdfElement (const char *pszType, PdfObject *pObject)
 
 PdfElement (EPdfDataType eExpectedDataType, PdfObject *pObject)
 
const char * TypeNameForIndex (int i, const char **ppTypes, long lLen) const
 
int TypeNameToIndex (const char *pszType, const char **ppTypes, long lLen, int nUnknownValue) const
 
PdfObjectCreateObject (const char *pszType=NULL)
 
PdfObjectGetNonConstObject () const
 

Detailed Description

An annotation to a PdfPage To create an annotation use PdfPage::CreateAnnotation

See also
PdfPage::CreateAnnotation

Constructor & Destructor Documentation

◆ PdfAnnotation() [1/2]

PoDoFo::PdfAnnotation::PdfAnnotation ( PdfPage pPage,
EPdfAnnotation  eAnnot,
const PdfRect rRect,
PdfVecObjects pParent 
)

Create a new annotation object

Parameters
pPagethe parent page of this annotation
eAnnottype of the annotation
rRectthe rectangle in which the annotation will appear on the page
pParentparent of this annotation
See also
PdfPage::CreateAnnotation

◆ PdfAnnotation() [2/2]

PoDoFo::PdfAnnotation::PdfAnnotation ( PdfObject pObject,
PdfPage pPage 
)

Create a PdfAnnotation from an existing object

Parameters
pObjectthe annotations object
pPagethe page of the annotation

Member Function Documentation

◆ GetAction()

PdfAction * PoDoFo::PdfAnnotation::GetAction ( ) const

Get the action that is executed for this annotation

Returns
an action object. The action object is owned by the PdfAnnotation.
See also
SetAction

◆ GetColor()

PdfArray PoDoFo::PdfAnnotation::GetColor ( ) const

Get the color key of the Annotation dictionary which defines the color of the annotation, as per 8.4 of the pdf spec. The PdfArray contains 0 to four numbers, depending on the colorspace in which the color is specified 0 numbers means the annotation is transparent 1 number specifies the intensity of the color in grayscale 3 numbers specifie the color in the RGB colorspace and 4 numbers specify the color in the CMYK colorspace

Returns
a PdfArray of either 0, 1, 3 or 4 numbers depending on the colorspace in which the color is specified

◆ GetContents()

PdfString PoDoFo::PdfAnnotation::GetContents ( ) const

Get the text of this annotation

Returns
the contents of this annotation
See also
SetContents

◆ GetDestination()

PdfDestination PoDoFo::PdfAnnotation::GetDestination ( PdfDocument pDoc) const

Get the destination of a link annotations

Parameters
pDoca PdfDocument owning this annotation. This is required to resolve names and pages.
Returns
a destination object
See also
SetDestination

◆ GetFileAttachement()

PdfFileSpec * PoDoFo::PdfAnnotation::GetFileAttachement ( ) const

Get a file attachement of this annotation.

Returns
a file specification object. The file specification object is owned by the PdfAnnotation.
See also
SetFileAttachement

◆ GetFlags()

pdf_uint32 PoDoFo::PdfAnnotation::GetFlags ( ) const

Get the flags of this annotation.

Returns
the flags which is an unsigned 32bit integer with different EPdfAnnotationFlags OR'ed together.
See also
SetFlags

◆ GetOpen()

bool PoDoFo::PdfAnnotation::GetOpen ( ) const
Returns
true if this annotation should be opened immediately by the viewer

◆ GetPage()

PdfPage * PoDoFo::PdfAnnotation::GetPage ( ) const
inline

Get the page of this PdfField

Returns
the page of this PdfField

◆ GetQuadPoints()

PdfArray PoDoFo::PdfAnnotation::GetQuadPoints ( ) const

Get the quad points associated with the annotation (if appropriate). This array is used in text markup annotations to describe the regions affected by the markup (i.e. the hilighted words, one quadrilateral per word)

Returns
a PdfArray of 8xn numbers describing the x,y coordinates of BL BR TR TL corners of the quadrilaterals. If inappropriate, returns an empty array.

◆ GetRect()

PdfRect PoDoFo::PdfAnnotation::GetRect ( ) const

Get the rectangle of this annotation.

Returns
a rectangle

◆ GetTitle()

PdfString PoDoFo::PdfAnnotation::GetTitle ( ) const

Get the title of this annotation

Returns
the title of this annotation
See also
SetTitle

◆ GetType()

EPdfAnnotation PoDoFo::PdfAnnotation::GetType ( ) const
inline

Get the type of this annotation

Returns
the annotation type

◆ HasAction()

bool PoDoFo::PdfAnnotation::HasAction ( ) const
Returns
true if this annotation has an action

◆ HasAppearanceStream()

bool PoDoFo::PdfAnnotation::HasAppearanceStream ( ) const
Returns
true if this annotation has an appearance stream

◆ HasDestination()

bool PoDoFo::PdfAnnotation::HasDestination ( ) const
Returns
true if this annotation has an destination

◆ HasFileAttachement()

bool PoDoFo::PdfAnnotation::HasFileAttachement ( ) const
Returns
true if this annotation has a file attachement

◆ SetAction()

void PoDoFo::PdfAnnotation::SetAction ( const PdfAction rAction)

Set the action that is executed for this annotation

Parameters
rActionan action object
See also
GetAction

◆ SetAppearanceStream()

void PoDoFo::PdfAnnotation::SetAppearanceStream ( PdfXObject pObject,
EPdfAnnotationAppearance  eAppearance = ePdfAnnotationAppearance_Normal,
const PdfName state = "" 
)

Set an appearance stream for this object to specify its visual appearance

Parameters
pObjectan XObject
eApperancean apperance type to set
statethe state for which set it the pObject; states depend on the annotation type

◆ SetBorderStyle() [1/2]

void PoDoFo::PdfAnnotation::SetBorderStyle ( double  dHCorner,
double  dVCorner,
double  dWidth 
)

Set the annotations border style.

Parameters
dHCornerhoritzontal corner radius
dVCornervertical corner radius
dWidthwidth of border

◆ SetBorderStyle() [2/2]

void PoDoFo::PdfAnnotation::SetBorderStyle ( double  dHCorner,
double  dVCorner,
double  dWidth,
const PdfArray rStrokeStyle 
)

Set the annotations border style.

Parameters
dHCornerhoritzontal corner radius
dVCornervertical corner radius
dWidthwidth of border
rStrokeStylea custom stroke style pattern

◆ SetColor() [1/4]

void PoDoFo::PdfAnnotation::SetColor ( )

Set the C key of the Annotation dictionary to an empty array, which, as per 8.4 of the pdf spec., makes the annotation transparent

◆ SetColor() [2/4]

void PoDoFo::PdfAnnotation::SetColor ( double  c,
double  m,
double  y,
double  k 
)

Set the C key of the Annotation dictionary, which defines the color of the annotation, as per 8.4 of the pdf spec. Parameters give the color in cmyk colorspace coordinates

Parameters
cnumber from 0 to 1, the intensity of the cyan channel
mnumber from 0 to 1, the intensity of the magneta channel
ynumber from 0 to 1, the intensity of the yellow channel
knumber from 0 to 1, the intensity of the black channel

◆ SetColor() [3/4]

void PoDoFo::PdfAnnotation::SetColor ( double  gray)

Set the C key of the Annotation dictionary, which defines the color of the annotation, as per 8.4 of the pdf spec. Parameters give the color in grayscale colorspace coordinates

Parameters
graynumber from 0 to 1, the intensity of the black

◆ SetColor() [4/4]

void PoDoFo::PdfAnnotation::SetColor ( double  r,
double  g,
double  b 
)

Set the C key of the Annotation dictionary, which defines the color of the annotation, as per 8.4 of the pdf spec. Parameters give the color in rgb colorspace coordinates

Parameters
rnumber from 0 to 1, the intensity of the red channel
gnumber from 0 to 1, the intensity of the green channel
bnumber from 0 to 1, the intensity of the blue channel

◆ SetContents()

void PoDoFo::PdfAnnotation::SetContents ( const PdfString sContents)

Set the text of this annotation.

Parameters
sContentstext of the annoation as string in PDF format
See also
GetContents

◆ SetDestination()

void PoDoFo::PdfAnnotation::SetDestination ( const PdfDestination rDestination)

Set the destination for link annotations

Parameters
rDestinationtarget of the link
See also
GetDestination

◆ SetFileAttachement()

void PoDoFo::PdfAnnotation::SetFileAttachement ( const PdfFileSpec rFileSpec)

Set a file attachment for this annotation. The type of this annotation has to be ePdfAnnotation_FileAttachement for file attachements to work.

Parameters
rFileSpeca file specification

◆ SetFlags()

void PoDoFo::PdfAnnotation::SetFlags ( pdf_uint32  uiFlags)

Set the flags of this annotation.

Parameters
uiFlagsis an unsigned 32bit integer with different EPdfAnnotationFlags OR'ed together.
See also
GetFlags

◆ SetOpen()

void PoDoFo::PdfAnnotation::SetOpen ( bool  b)

Sets wether this annotation is initialy open. You should always set this true for popup annotations.

Parameters
bif true open it

◆ SetQuadPoints()

void PoDoFo::PdfAnnotation::SetQuadPoints ( const PdfArray rQuadPoints)

Set the quad points associated with the annotation (if appropriate). This array is used in text markup annotations to describe the regions affected by the markup (i.e. the hilighted words, one quadrilateral per word)

Parameters
rQuadPointsa PdfArray of 8xn numbers describing the x,y coordinates of BL BR TR TL corners of the quadrilaterals.

◆ SetRect()

void PoDoFo::PdfAnnotation::SetRect ( const PdfRect rRect)

Set the rectangle of this annotation.

Parameters
rRectrectangle to set

◆ SetTitle()

void PoDoFo::PdfAnnotation::SetTitle ( const PdfString sTitle)

Set the title of this annotation.

Parameters
sTitletitle of the annoation as string in PDF format
See also
GetTitle