DL Logo

PDAnnotHandler Typedefs

PDAnnotHandler

Header: PDExpT.h:535

Description

A data structure containing callbacks that implement an annotation manager. The callbacks implement the annotation manager functions (for example, view, delete, or export the annotations of a document as a list, sorted by type, author, or date).

To fully use a PDAnnotHandler, the AVAnnotHandler associated with this annotation must have its AVAnnotHandlerGetInfoProc() and AVAnnotHandlerDeleteInfoProc() callbacks defined.

Syntax

typedef struct _t_PDAnnotHandler *PDAnnotHandler;

Returned From

Used By

PDAnnotHandlerClipboardData

Header: PDExpT.h:548

Description

Opaque data used by PDAnnotHandlers.

Syntax

typedef void *PDAnnotHandlerClipboardData;

Used By

PDAnnotHandler Callback Signatures

PDAnnotHandlerCanCopyProc

Header: PDExpT.h:701

Description

(Optional) A callback for PDAnnotHandler. It returns true if the copy operation is expected to succeed. It tests, for example, whether copying is allowed by document permissions.

Syntax

ASBool PDAnnotHandlerCanCopyProc(PDAnnotHandler pdanh, PDPage sourcePage, PDAnnot pdan);

Parameters

pdanh
IN/OUT The annotation handler responsible for this annotation.
sourcePage
The page the annotation is on.
pdan
IN/OUT The annotation object.

Returns

true if the annotation can be copied, false if it cannot.

Used In

PDAnnotHandlerCanPasteProc

Header: PDExpT.h:750

Description

(Optional) A callback for PDAnnotHandler. It returns true if the paste operation is expected to succeed. It tests whether data from an annotation that has been copied to a clipboard can be pasted to a location on a page. Pasting can be disallowed by document permissions, or because the annotation cannot be accurately reproduced in the destination document.

Syntax

ASBool PDAnnotHandlerCanPasteProc(PDAnnotHandler pdanh, PDPage destPage, const ASFixedPoint *center, PDAnnotHandlerClipboardData data);

Parameters

pdanh
The annotation handler responsible for this annotation.
destPage
The page to which the annotation would be pasted.
center
The location for the center of the annotation on the destination page, or a NULL pointer to center the annotation on the destination page's crop box.
data
The copied annotation data to test.

Returns

true if the annotation data can be pasted, false otherwise.

Used In

PDAnnotHandlerCopyProc

Header: PDExpT.h:722

Description

(Optional) A callback for PDAnnotHandler. It copies data from the annotation object to a new clipboard structure, and returns the clipboard structure.

Syntax

PDAnnotHandlerClipboardData PDAnnotHandlerCopyProc(PDAnnotHandler pdanh, PDPage sourcePage, PDAnnot pdan);

Parameters

pdanh
The annotation handler responsible for this annotation.
sourcePage
The page containing the annotation to be copied.
pdan
The annotation object.

Returns

The clipboard structure containing the copied data.

Used In

PDAnnotHandlerDeleteAnnotInfoProc

Header: PDExpT.h:597

Description

(Optional) A callback for PDAnnotHandler. It deletes information associated with an annotation. It frees all the memory associated with the annotation information.

Syntax

void PDAnnotHandlerDeleteAnnotInfoProc(PDAnnotHandler pdanh, PDAnnotInfo info);

Parameters

pdanh
IN/OUT The annotation handler responsible for this annotation.
information
IN/OUT Information associated with the annotation.

Used In

PDAnnotHandlerDestroyDataProc

Header: PDExpT.h:794

Description

(Optional) A callback for PDAnnotHandler. It destroys data from an annotation that has been copied to a clipboard. This callback may be executed regardless of how many times (if any) the annotation was pasted.

Syntax

void PDAnnotHandlerDestroyDataProc(PDAnnotHandler pdanh, PDAnnotHandlerClipboardData data);

Parameters

pdanh
The annotation handler responsible for this annotation.
data
The copied annotation data to destroy.

Used In

PDAnnotHandlerDestroyProc

Header: PDExpT.h:805

Description

(Optional) A callback for PDAnnotHandler. It destroys the annotation handler structure when the application no longer requires it. The handler should destroy any dynamic memory stored in the userData field.

Related Methods

Syntax

void PDAnnotHandlerDestroyProc(PDAnnotHandler pdanh);

Parameters

pdanh
The annotation handler to destroy.

Used In

PDAnnotHandlerGetAnnotInfoFlagsProc

Header: PDExpT.h:685

Description

A callback for PDAnnotHandler. It gets the annotation handler information flags, which indicate the operations allowed with annotations of this type.

Syntax

ASFlagBits PDAnnotHandlerGetAnnotInfoFlagsProc(PDAnnotHandler pdanh, PDAnnot pdan);

Parameters

pdanh
IN/OUT The annotation handler responsible for the annotation.
pdan
IN/OUT The annotation.

Returns

The operations allowed.

The value is an OR of the following flags:

Operation

Description
It is okay to summarize annotations.
It is okay to filter annotations.
It is okay to manage annotations.
Allow modifying this annotation type in a write-protected document.
All operations are allowed.

Used In

PDAnnotHandlerGetAnnotInfoProc

Header: PDExpT.h:582

Description

A callback for PDAnnotHandler. It gets the annotation information for an annotation.

Syntax

PDAnnotInfo PDAnnotHandlerGetAnnotInfoProc(PDAnnotHandler pdanh, PDAnnot pdan, PDPage pdpage);

Parameters

pdanh
IN/OUT The annotation handler responsible for this annotation.
pdan
IN/OUT The annotation for which information is obtained.
pdpage
IN/OUT The page associated with the annotation for which information is obtained. If the page associated with the annotation is not known, pass NULL.

Returns

The annotation information, described in a PDAnnotInfo structure.

Used In

PDAnnotHandlerGetHeelPointProc

Header: PDExpT.h:818

Description

A callback for PDAnnotHandler. It gets the heel point (the focus or starting point) for the annotation. For a rectangular annotation, this is usually the top left corner.

Related Methods

Syntax

void PDAnnotHandlerGetHeelPointProc(PDAnnotHandler pdanh, PDAnnot pdan, ASFixedPoint *point);

Parameters

pdanh
The annotation handler whose heel point is obtained.
pdan
The annotation object.
point
(Filled by the method) The heel point for the annotation.

Used In

PDAnnotHandlerGetPrintAppearanceProc

Header: PDExpT.h:840

Description

A callback for PDAnnotHandler. It is called by the host application to obtain a print appearance (a Form XObject). If this callback is not implemented, the default appearance (if any) is used.

Related Methods

Syntax

CosObj PDAnnotHandlerGetPrintAppearanceProc(PDAnnotHandler pdanh, PDAnnot pdan, ASFixedRect *frAnnot, PDAnnotPrintOp op);

Parameters

pdanh
The annotation handler whose print appearance is obtained.
pdan
The annotation object.
frAnnot
The rectangle in user space in which the annotation will be printed. The handler is free to modify it.
op
The print operation being performed. This is kPDAnnotPrintStandard for a standard print operation, or kPDAnnotPrintVariableData if the user selected Form Fields Only.

Returns

The Form XObject representing the print appearance of the annotation.

Used In

PDAnnotHandlerGetTypeProc

Header: PDExpT.h:611

Description

A callback for PDAnnotHandler. It gets an ASAtom indicating the annotation type for which the handler is responsible. This corresponds to the annotation's Subtype key in the PDF file.

Syntax

ASAtom PDAnnotHandlerGetTypeProc(PDAnnotHandler pdanh);

Parameters

pdanh
IN/OUT The annotation handler whose type is returned.

Returns

The annotation type for which this handler is responsible.

Used In

PDAnnotHandlerPasteProc

Header: PDExpT.h:775

Description

(Optional) A callback for PDAnnotHandler. It creates a new annotation on the specified page using clipboard data generated by PDAnnotCopy().

Syntax

PDAnnot PDAnnotHandlerPasteProc(PDAnnotHandler pdanh, PDPage destPage, const ASFixedPoint *center, PDAnnotHandlerClipboardData data);

Parameters

pdanh
The annotation handler responsible for this annotation.
destPage
The page to which the annotation is pasted.
center
The location for the center of the annotation on the destination page, or a NULL pointer to center the annotation in the destination page's crop box.
data
The copied annotation data to paste.

Returns

The new annotation object associated with the page's document.

Used In

PDAnnotHandler Structures

_t_PDAnnotHandler

Header: PDExpT.h:855

Description

A data structure containing callbacks that implement an annotation manager. The callbacks implement the annotation manager functions (for example, view, delete, or export the annotations of a document as a list, sorted by type, author, or date).

To fully use a PDAnnotHandler, the AVAnnotHandler associated with this annotation must have its AVAnnotHandlerGetInfoProc() and AVAnnotHandlerDeleteInfoProc() callbacks defined.

Related Methods

Syntax

struct _t_PDAnnotHandler {
ASSize_t size;
The size of the data structure. It must be set to sizeof(PDAnnotHandlerRec).
void *userData;
A pointer to a block of user-supplied data.
PDDocWillExportAnnotProc WillExportAnnot;
PDDocWillImportAnnotProc WillImportAnnot;
PDAnnotWillPrintProc WillPrintAnnot;
} PDAnnotHandlerRec;

Used In

PDAnnotHandler Functions

PDGetAnnotHandlerByName

Header: PDProcs.h:6933

Description

Gets the annotation handler that handles the specified annotation type.

Related Methods

Syntax

PDAnnotHandler PDGetAnnotHandlerByName(ASAtom name);

Parameters

name
IN/OUT The name of the requested annotation handler. The character string for the name can be converted to an ASAtom using ASAtomFromString().

Returns

The annotation handler that services annotations of type name. It returns the default annotation handler if no handler services the specified annotation type.

PDRegisterAnnotHandler

Header: PDProcs.h:6917

Description

Registers a handler for an annotation subtype, replacing any previous handler that had been registered for that subtype. The annotation handler is not registered if its PDAnnotHandlerGetTypeProc() returns NULL.

To effectively use a PDAnnotHandler, the AVAnnotHandler associated with this annotation must have its AVAnnotHandlerGetInfoProc() and AVAnnotHandlerDeleteInfoProc() callbacks defined.

PDF Library applications can use this method to register their annotation handlers. Link and Watermark annotations have default handlers. For other annotation types, the applications should register their own handlers.

Related Methods

Syntax

void PDRegisterAnnotHandler(PDAnnotHandler handler);

Parameters

handler
IN/OUT A pointer to a structure containing the annotation handler's callbacks. This structure must not be freed after this call, but must be retained.