FileAttachmentAnnotation

FileAttachmentAnnotation

Overview

FileAttachmentAnnotation is a type in Aspose.PDF FOSS for Go.

FileAttachmentAnnotation embeds a file in the document and shows an icon at the annotation’s /Rect.

This type provides 13 methods for working with FileAttachmentAnnotation objects in Go programs. Available methods include: AnnotationType, FileBytes, FileDescription, FileMIMEType, FileName, FileSize, HasFile, Icon, RegenerateAppearance, SetFile, SetFileDescription, SetFileFromStream, and 1 additional methods. All public members are accessible to any Go application after installing the Aspose.PDF FOSS for Go package.

Methods

SignatureDescription
AnnotationType()AnnotationTypeReturns the annotation type.
Icon()FileAttachmentIconIcon returns the /Name entry mapped to a FileAttachmentIcon.
SetIcon(i: FileAttachmentIcon)SetIcon writes the /Name entry.
HasFile()boolHasFile returns true if SetFile or SetFileFromStream has been called successfully and not subsequently cleared.
RegenerateAppearance()RegenerateAppearance is a no-op for FileAttachmentAnnotation (no /AP — viewers render the icon themselves).
SetFile(path: string)errorSetFile embeds the file at path as the annotation’s attachment.
SetFileFromStream(r: io.Reader, name: string)errorSetFileFromStream is the io.Reader variant of SetFile.
FileName()stringFileName returns the displayed filename from /Filespec/F.
FileMIMEType()stringFileMIMEType returns the /Subtype on /EmbeddedFile (e.g.
FileSize()intFileSize returns the size of the embedded file in bytes.
FileBytes()[]byteFileBytes returns a defensive copy of the embedded file’s raw bytes.
FileDescription()stringFileDescription returns /Filespec/Desc.
SetFileDescription(s: string)SetFileDescription writes /Filespec/Desc.

See Also