Class: FileAttachmentAnnot

PDFNet. FileAttachmentAnnot


new FileAttachmentAnnot()

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

Extends

  • MarkupAnnot

Members


<static> Icon

Properties:
Name Type Description
e_Graph number
e_PushPin number
e_Paperclip number
e_Tag number
e_Unknown number

Methods


<static> createDefault(doc, pos, path)

Parameters:
Name Type Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc
pos PDFNet.Rect
path string
Returns:
A promise that resolves to an object of type: "PDFNet.FileAttachmentAnnot"
Type
Promise.<PDFNet.FileAttachmentAnnot>

<static> createFromObj( [d])

creates an FileAttachment annotation and initializes it using given Cos/SDF object. d Cos/SDF object used to initialize the FileAttachment annotation
Parameters:
Name Type Argument Description
d PDFNet.Obj <optional>
The Cos/SDF object to initialze the annotation with.
Returns:
A promise that resolves to an object of type: "PDFNet.FileAttachmentAnnot"
Type
Promise.<PDFNet.FileAttachmentAnnot>

<static> createWithFileSpec(doc, pos, fs [, icon_name])

Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file.
Parameters:
Name Type Argument Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc A document to which the annotation is added.
pos PDFNet.Rect A rectangle specifying the annotation's bounds, in user space coordinates.
fs PDFNet.FileSpec a file specification object used to initialize the file attachment annotation.
icon_name number <optional>
PDFNet.FileAttachmentAnnot.Icon = {
	e_Graph : 0
	e_PushPin : 1
	e_Paperclip : 2
	e_Tag : 3
	e_Unknown : 4
}
The name of an icon to be used in displaying the annotation, default is PushPin.
Returns:
A promise that resolves to a new file attachment annotation.
Type
Promise.<PDFNet.FileAttachmentAnnot>

createFromAnnot()

Returns:
A promise that resolves to an object of type: "PDFNet.Annot"
Type
Promise.<PDFNet.Annot>

export( [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. If the file is not embedded and the external file can't be found, the function returns false.
Parameters:
Name Type Argument Description
save_as string <optional>
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:
A promise that resolves to true is the file was saved successfully, false otherwise.
Type
Promise.<boolean>

getFileSpec()

Returns:
A promise that resolves to the file specification that contains a file reference or the embedded file data stream.
Type
Promise.<PDFNet.FileSpec>

getIcon()

Default Value:
  • e_PushPin
Returns:
A promise that resolves to the type the associated icon style.
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.FileAttachmentAnnot.Icon = {
	e_Graph : 0
	e_PushPin : 1
	e_Paperclip : 2
	e_Tag : 3
	e_Unknown : 4
}
</pre>

getIconName()

Returns the name of the icon associated with the FileAttachment annotation.
See:
  • GetIcon() GetIconName() returns the icon name as it appears in the annotation dictionary, while GetIcon() returns the same icon name converted to enumeration value.
Returns:
A promise that resolves to a string denoting the name of the icon.
Type
Promise.<string>

setFileSpec(file)

sets the file specification.
Parameters:
Name Type Description
file PDFNet.FileSpec The file specification to associate with this annotation.. The file specification contains a file reference or the embedded file data stream.
Returns:
Type
Promise.<void>

setIcon( [type])

sets the icon style associated with FileAttachment annotation. (Optional)
Parameters:
Name Type Argument Description
type number <optional>
PDFNet.FileAttachmentAnnot.Icon = {
	e_Graph : 0
	e_PushPin : 1
	e_Paperclip : 2
	e_Tag : 3
	e_Unknown : 4
}
icon style.
Default Value:
  • e_PushPin
Returns:
Type
Promise.<void>

setIconName(iname)

sets the name of the icon associated with the FileAttachment annotation. (Optional)
Parameters:
Name Type Description
iname string A string.denoting the name of the icon.
See:
  • SetIcon()
Returns:
Type
Promise.<void>