public class

FileAttachment

extends Markup
java.lang.Object
   ↳ com.pdftron.pdf.Annot
     ↳ com.pdftron.pdf.annots.Markup
       ↳ com.pdftron.pdf.annots.FileAttachment

Class Overview

A file attachment annotation (PDF 1.3) contains a reference to a file, which typically shall be embedded in the PDF file.

Summary

Constants
int e_Graph For each FileAttachment annotation, one can specify the icon used to display the annotation by choosing one of the entries the following integer list.
int e_Paperclip The Constant e_Paperclip.
int e_PushPin The Constant e_PushPin.
int e_Tag The Constant e_Tag.
int e_Unknown The Constant e_Unknown.
[Expand]
Inherited Constants
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
Public Constructors
FileAttachment(Obj d)
Creates an FileAttachment annotation and initialize it using given Cos/SDF object.
FileAttachment()
Creates an empty FileAttachment annotation.
FileAttachment(Annot annot)
Creates an FileAttachment annotation and initialize it using given annotation object.
Public Methods
void SetFileSpec(FileSpec file)
Set the file specification.
void SetIconName(String icon)
Set the icon type using a string.
static FileAttachment create(Doc doc, Rect pos, String path)
Creates a file attachment annotation.
static FileAttachment create(Doc doc, Rect pos, String path, String icon_name)
Creates FileAttachment
void export()
The function saves the data referenced by this File Attachment to an external file.
void export(String save_as)
The function saves the data referenced by this File Attachment to an external file.
FileSpec getFileSpec()
Get the file specification.
int getIcon()
Get the icon type as an entry of the enum "Icon".
String getIconName()
Get the icon type as a string.
void setIcon(int type)
Set the icon type using an entry of the enum "Icon".
[Expand]
Inherited Methods
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
From class java.lang.Object

Constants

public static final int e_Graph

For each FileAttachment annotation, one can specify the icon used to display the annotation by choosing one of the entries the following integer list. e_GraphPushPin - The icon has a graph push pin appearance. e_PaperclipTag - The icon has a paper clip tag appearance. e_Unknow - Undefined.

Constant Value: 0 (0x00000000)

public static final int e_Paperclip

The Constant e_Paperclip.

Constant Value: 2 (0x00000002)

public static final int e_PushPin

The Constant e_PushPin.

Constant Value: 1 (0x00000001)

public static final int e_Tag

The Constant e_Tag.

Constant Value: 3 (0x00000003)

public static final int e_Unknown

The Constant e_Unknown.

Constant Value: 4 (0x00000004)

Public Constructors

public FileAttachment (Obj d)

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

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

Parameters
d the input Cos/SDF object

public FileAttachment ()

Creates an empty FileAttachment annotation.

public FileAttachment (Annot annot)

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

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

Parameters
annot input annotation object

Public Methods

public void SetFileSpec (FileSpec file)

Set the file specification.

Parameters
file The file associated with this annotation.

public void SetIconName (String icon)

Set the icon type using a string. (Optional)

Note: the string spedifies the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard names: GraphPushPin PaperclipTag Additional names may be supported as well. Default value: PushPin. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over the this entry

Parameters
icon The string specifying the icon type associated with this FileAttachment annotation.

public static FileAttachment create (Doc doc, Rect pos, String path)

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

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.

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, specified in user space coordinates.
path the path
Returns
  • A new file attachment annotation.

public static FileAttachment create (Doc doc, Rect pos, String path, String icon_name)

Creates FileAttachment

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, in user space coordinates.
path path to the referenced file
icon_name the The name of an icon to be used in displaying the annotation, default is PushPin.
Returns
  • file attachment

public void export ()

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.

public void export (String save_as)

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.

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().

public FileSpec getFileSpec ()

Get the file specification.

Returns
  • The file associated with this annotation.

public int getIcon ()

Get the icon type as an entry of the enum "Icon".

Note: The entry specifies the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard names: GraphPushPin PaperclipTag Additional names may be supported as well. Default value: PushPin. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over the this entry

Returns
  • The enum "Icon" entry associated with this FileAttachment annotation.

public String getIconName ()

Get the icon type as a string.

Note: the string spedifies the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard names: GraphPushPin PaperclipTag Additional names may be supported as well. Default value: PushPin. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over the this entry

Returns
  • The string specifying the icon type associated with this FileAttachment annotation.

public void setIcon (int type)

Set the icon type using an entry of the enum "Icon". (Optional)

Note: The entry specifies the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard names: GraphPushPin PaperclipTag Additional names may be supported as well. Default value: PushPin. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over the this entry

Parameters
type The enum "Icon" entry associated with this FileAttachment annotation.