pdftron::PDF::Annots::FileAttachment Class Reference

A file attachment annotation contains a reference to a file, which may be embedded in the PDF document. More...

#include <FileAttachment.h>

Inheritance diagram for pdftron::PDF::Annots::FileAttachment:

Inheritance graph
[legend]
Collaboration diagram for pdftron::PDF::Annots::FileAttachment:

Collaboration graph
[legend]

List of all members.

Public Types

enum  Icon {
  e_Graph, e_PushPin, e_Paperclip, e_Tag,
  e_Unknown
}
 Icon style. More...

Public Member Functions

 FileAttachment (SDF::Obj d=0)
 Creates an FileAttachment annotation and initializes it using given Cos/SDF object.
 FileAttachment (const Annot &ann)
 Creates an FileAttachment annotation and initializes it using given annotation object.
FileSpec GetFileSpec () const
void SetFileSpec (const FileSpec &file)
 Sets the file specification.
bool Export (const UString &save_as="") const
 The function saves the data referenced by this File Attachment to an external file.
Icon GetIcon () const
void SetIcon (Icon type=e_PushPin)
 Sets the icon style associated with FileAttachment annotation.
const char * GetIconName () const
 Returns the name of the icon associated with the FileAttachment annotation.
void SetIconName (const char *icon)
 Sets the name of the icon associated with the FileAttachment annotation.

Static Public Member Functions

static FileAttachment Create (SDF::SDFDoc &doc, const Rect &pos, FileSpec fs, Icon icon_name=e_PushPin)
 Creates a file attachment annotation.
static FileAttachment Create (SDF::SDFDoc &doc, const Rect &pos, const char *path, Icon icon_name=e_PushPin)
 Creates a file attachment annotation.
static FileAttachment Create (SDF::SDFDoc &doc, const Rect &pos, const char *path, const char *icon_name)
 Creates a file attachment annotation.


Detailed Description

A file attachment annotation contains a reference to a file, which may be embedded in the PDF document.

Member Enumeration Documentation

Icon style.

Enumerator:
e_Graph  The icon has graph appearance.
e_PushPin  The icon has a push pin appearance.
e_Paperclip  The icon has a paper clip appearance.
e_Tag  The icon has tag appearance.
e_Unknown  The icon has unrecognized appearance type.


Constructor & Destructor Documentation

pdftron::PDF::Annots::FileAttachment::FileAttachment ( SDF::Obj  d = 0  ) 

Creates an FileAttachment annotation and initializes it using given Cos/SDF object.

Note:
The constructor does not copy any data, but is instead the logical equivalent of a type cast.

pdftron::PDF::Annots::FileAttachment::FileAttachment ( const Annot ann  )  [inline]

Creates an FileAttachment annotation and initializes it using given annotation object.

Note:
The constructor does not copy any data, but is instead the logical equivalent of a type cast.


Member Function Documentation

static FileAttachment pdftron::PDF::Annots::FileAttachment::Create ( SDF::SDFDoc doc,
const Rect pos,
FileSpec  fs,
Icon  icon_name = e_PushPin 
) [static]

Creates a file attachment annotation.

A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file.

Parameters:
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, in user space coordinates.
icon_name The name of an icon to be used in displaying the annotation, default is PushPin.
Note:
PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph, PushPin, Paperclip, Tag. Additional names may be supported as well. Default value: PushPin.
Returns:
A new file attachment annotation.

static FileAttachment pdftron::PDF::Annots::FileAttachment::Create ( SDF::SDFDoc doc,
const Rect pos,
const char *  path,
Icon  icon_name = e_PushPin 
) [static]

Creates a file attachment annotation.

A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file.

Parameters:
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, in user space coordinates.
icon_name The name of an icon to be used in displaying the annotation, default is PushPin.
Note:
PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin.
Returns:
A new file attachment annotation.

static FileAttachment pdftron::PDF::Annots::FileAttachment::Create ( SDF::SDFDoc doc,
const Rect pos,
const char *  path,
const char *  icon_name 
) [static]

Creates a file attachment annotation.

This method should be used when a nonstandard icon type is desired in the annotation.

A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file.

Parameters:
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, in user space coordinates.
icon_name The name of an icon to be used in displaying the annotation, default is PushPin.
Note:
PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin.
Returns:
A new file attachment annotation.

FileSpec pdftron::PDF::Annots::FileAttachment::GetFileSpec (  )  const

Returns:
the file specification that contains a file reference or the embedded file data stream.

void pdftron::PDF::Annots::FileAttachment::SetFileSpec ( const FileSpec file  ) 

Sets the file specification.

Parameters:
file The file specification to associate with this annotation.. The file specification contains a file reference or the embedded file data stream.

bool pdftron::PDF::Annots::FileAttachment::Export ( const UString save_as = ""  )  const

The function saves the data referenced by this File Attachment to an external file.

If the file is embedded, the function saves the embedded file. If the file is not embedded, the function will copy the external file. If the file is not embedded and the external file can't be found, the function returns false.

Parameters:
save_as An optional parameter indicating the filepath and filename where the data should be saved. If this parameter is not specified the function will attempt to save the file using FileSpec.GetFilePath().
Returns:
true is the file was saved successfully, false otherwise.

Icon pdftron::PDF::Annots::FileAttachment::GetIcon (  )  const

Returns:
the type the associated icon style. e_PushPin
Note:
The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.

void pdftron::PDF::Annots::FileAttachment::SetIcon ( Icon  type = e_PushPin  ) 

Sets the icon style associated with FileAttachment annotation.

(Optional)

Parameters:
type icon style. e_PushPin
Note:
The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.

const char* pdftron::PDF::Annots::FileAttachment::GetIconName (  )  const

Returns the name of the icon associated with the FileAttachment annotation.

Returns:
A string denoting the name of the icon.
See also:
GetIcon() GetIconName() returns the icon name as it appears in the annotation dictionary, while GetIcon() returns the same icon name converted to enumeration value.
Note:
The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.

void pdftron::PDF::Annots::FileAttachment::SetIconName ( const char *  icon  ) 

Sets the name of the icon associated with the FileAttachment annotation.

(Optional)

Parameters:
icon A string.denoting the name of the icon.
Note:
this method should be used to assign non-standard icon type to the annotation.
See also:
SetIcon()
Note:
The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.


© 2002-2010 PDFTron Systems Inc.