File Attachment Annotations
File attachment annotations are annotations that represent an attached file in the document. Users can annotate their documents with files that can also be downloaded.
File attachment are created with NoZoom and NoRotate set to true by default. This means they will remain the same size at all zoom levels and will not rotate with the view/page. Stroke color is also used as the primary color of the icons as opposed to fill color.
In the PDF specification, there are no specifications for file restrictions or attachment size limits. WebViewer has provided options to tweaks these from the tool that creates file attachment annotations.

Instantiation
XFDF
Element name: fileattachment
Required properties
PageNumber
Gets or sets the page number of a document that the annotation appears on.
X
Gets or sets the annotation's x-axis position.
Y
Gets or sets the annotation's y-axis position.
Notable properties
For the full list of properties, please visit the annotation's API docs.
Icon
The name of the icon to use for this file attachment annotation. Possible default icon types:
Graph
PushPin
Paperclip
Tag
Author
The author of the annotation.
Color
Gets or sets the annotation's stroke color.
Hidden
Gets or sets whether the annotation is hidden.
Invisible
Gets or sets whether the annotation is invisible, only if it is an unknown annotation type. Generally for hiding annotations you should use "Hidden".
IsClickableOutsideRect
Gets or sets whether any parts of the annotation drawn outside of the rect are clickable.
Listable
Gets or sets whether the annotation should be listed in annotation lists. If set to false, the annotation will also become unselectable.
Locked
Gets or sets whether the annotation is locked or not. If it's locked it can't be edited or deleted, but the note can be edited.
LockedContents
Gets or sets whether the annotation contents are locked or not. If the contents are locked then note can't be edited but the annotation can be edited or deleted.
NoDelete
Gets or sets if this annotation can be deleted.
NoMove
Gets or sets whether or not the annotation can be moved.
NoResize
Gets or sets if this annotation can be resized by the user.
NoRotate
Gets or sets if this annotation can be rotated.
NoView
Gets or sets whether the annotation is visible on the screen. Differs from Hidden in that it can still be printed if the print flag is set.
NoZoom
Gets or sets if this annotation scales with the page.
Opacity
Gets or sets the opacity of the annotation.
Printable
Gets or sets whether the annotation should be displayed when printing the page.
ReadOnly
Gets or sets whether the annotation is readonly or not. If it's readonly both the annotation itself and its note can't be edited or deleted.
StrokeColor
Gets or sets the color of the annotation's stroke.
ToggleNoView
Gets or sets whether the ToggleNoView flag is set on the annotation.
Useful methods
getFileData
To get the file data from an attachment annotation, you can use getFileData which will asynchronously return the data as a blob. This can be used to trigger an automatic download of an attachment.
setFileData
Setting the file data on a file attachment annotation is recommended after construction using setFileData. This requires slightly more information other than just the file data, as you will need to provide the web mimetype of the attachment and filename. The filename can be different and will be used when downloaded.
getFileMetadata
If you need to understand the type of file that is stored in the attachment, you use getFileMetadata to get the mimetype and name of the file from when it was originally attached.
Last updated
Was this helpful?