DL Logo

PDTextAnnot Definitions

CastToPDTextAnnot

Header: PDExpT.h:440

Description

Casts a link annotation or a generic annotation to a text annotation.

Syntax

#define CastToPDTextAnnot ( a ) *( PDTextAnnot *) &( a )

Parameters

a
The link annotation or generic annotation to cast.

PDTextAnnot Typedefs

PDTextAnnot

Header: PDExpT.h:345

Description

A PDF text annotation on a page in a PDF file. You can use any PDAnnot method on a PDTextAnnot.

Applications can:

  • Get and set attributes including the rectangle, textual contents, and whether the annotation is open.
  • Create new text annotations, and delete or move existing ones using PDAnnot methods.
  • Manipulate the behavior of text annotations by modifying the Text Annotation Handler.

To obtain a PDF text annotation, use any of the PDAnnot calls, followed by CastToPDTextAnnot(). The annotation passed to CastToPDTextAnnot() must be a text annotation; it will not convert other annotation types into text annotations.

Syntax

typedef OPAQUE_64_BITS PDTextAnnot;

Used By

PDTextAnnot Functions

PDTextAnnotGetContents

Header: PDProcs.h:588

Description

Gets the text of a text annotation.

Note: This text is stored in either PDFDocEncoding or in Unicode. If it is stored in Unicode, a valid Byte Order Mark must be present.

Syntax

ASInt32 PDTextAnnotGetContents(PDTextAnnot aTextAnnot, char *buffer, ASInt32 bufSize);

Parameters

aTextAnnot
The text annotation whose text is obtained.
buffer
(Filled by the method) A buffer into which the text is placed. If the text is encoded using PDFDocEncoding, it can be converted to a platform's native encoding using PDXlateToHost() or PDXlateToHostEx().
bufSize
The maximum number of characters that buffer can hold.

Returns

The number of characters written into buffer.

PDTextAnnotGetContentsASText

Header: PDProcs.h:11527

Description

Gets the text of a text annotation as an ASText object.

Syntax

void PDTextAnnotGetContentsASText(PDTextAnnot aTextAnnot, ASText contents);

Parameters

aTextAnnot
The text annotation whose text is obtained.
contents
(Filled by the method) The text object containing the contents. The client must pass a valid ASText object title. The routine does not allocate it.

PDTextAnnotIsOpen

Header: PDProcs.h:630

Description

Tests whether a text annotation is open.

Note: This method cannot always correctly determine a text annotation's open state. For the current version of Acrobat, text and other annotations have an associated Popup annotation which maintains the open state of the popup window; the method works correctly when you pass it the popup annotation itself. You can use Cos-level routines to find the Popup entry in the annotation dictionary, which is itself a dictionary containing an Open entry.

Related Methods

Syntax

ASBool PDTextAnnotIsOpen(PDTextAnnot aTextAnnot);

Parameters

aTextAnnot
The text annotation whose open/closed state is obtained.

Returns

true if the annotation is open, false otherwise.

PDTextAnnotSetContents

Header: PDProcs.h:610

Description

Sets the text of a text annotation. This method also sets the modification date of the annotation to the current date and time.

Note: The text must be encoded using PDFDocEncoding or Unicode.

Syntax

void PDTextAnnotSetContents(PDTextAnnot aTextAnnot, const char *str, ASInt32 nBytes);

Parameters

aTextAnnot
The text annotation whose text is set.
str
A string containing the new text. The string must be encoded using PDFDocEncoding or Unicode. The strings in a platform's native encoding can be converted to PDFDocEncoding using PDXlateToPDFDocEnc() or PDXlateToPDFDocEncEx().
nBytes
The number of characters in str.

PDTextAnnotSetContentsASText

Header: PDProcs.h:11542

Description

Sets the text of a text annotation.

Syntax

void PDTextAnnotSetContentsASText(PDTextAnnot aTextAnnot, const ASText contents);

Parameters

aTextAnnot
The text annotation whose text is set.
contents
The text object containing the new text.

PDTextAnnotSetOpen

Header: PDProcs.h:651

Description

Opens or closes a text annotation.

Note: This method cannot always correctly set a text annotation's open state. For the current version of Acrobat, text and other annotations have an associated Popup annotation which maintains the open state of the popup window; the method works correctly when you pass it the popup annotation itself. You can use Cos-level routines to find the Popup entry in the annotation dictionary, which is itself a dictionary containing an Open entry.

Related Methods

Syntax

void PDTextAnnotSetOpen(PDTextAnnot aTextAnnot, ASBool isOpen);

Parameters

aTextAnnot
The annotation to open or close.
isOpen
true if the annotation is opened, false if the annotation is closed.