PTFileAttachment
@interface PTFileAttachment : PTMarkup
A file attachment annotation contains a reference to a file, which may be embedded in the PDF document.
-
Creates an FileAttachment annotation and initializes it using given Cos/SDF object. d Cos/SDF object used to initialize the FileAttachment annotation
Note
The constructor does not copy any data, but is instead the logical equivalent of a type cast.Parameters
d
The Cos/SDF object to initialze the annotation with.
-
Undocumented
Declaration
Objective-C
- (instancetype)init;
Swift
init!()
-
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.
Declaration
Objective-C
+ (PTFileAttachment *)CreateFileAttchWithFileSpec:(PTSDFDoc *)doc pos:(PTPDFRect *)pos fs:(PTFileSpec *)fs icon_name:(PTFileIcon)icon_name;
Swift
class func createFileAttch(withFileSpec doc: PTSDFDoc!, pos: PTPDFRect!, fs: PTFileSpec!, icon_name: PTFileIcon) -> PTFileAttachment!
Parameters
doc
A document to which the annotation is added.
pos
A rectangle specifying the annotation’s bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32
fs
a file specification object used to initialize the file attachment annotation.
icon_name
The name of an icon to be used in displaying the annotation, default is PushPin.
Return Value
A new file attachment annotation.
-
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.
Declaration
Objective-C
+ (PTFileAttachment *)Create:(PTSDFDoc *)doc pos:(PTPDFRect *)pos fs:(PTFileSpec *)fs;
Swift
class func create(_ doc: PTSDFDoc!, pos: PTPDFRect!, fs: PTFileSpec!) -> PTFileAttachment!
Parameters
doc
A document to which the annotation is added.
pos
A rectangle specifying the annotation’s bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32
path
The path to the file which should be attached
icon_name
An icon to be used in displaying the annotation, default is PushPin.
Return Value
A new file attachment annotation.
-
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.
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.
Declaration
Objective-C
+ (PTFileAttachment *)CreateAnnot:(PTSDFDoc *)doc pos:(PTPDFRect *)pos fs:(PTFileSpec *)fs icon_name:(PTFileIcon)icon_name;
Swift
class func createAnnot(_ doc: PTSDFDoc!, pos: PTPDFRect!, fs: PTFileSpec!, icon_name: PTFileIcon) -> PTFileAttachment!
Parameters
doc
A document to which the annotation is added.
pos
A rectangle specifying the annotation’s bounds, in user space coordinates.
path
The path to the file which should be attached
icon_name
The name of an icon to be used in displaying the annotation.
Return Value
A new file attachment annotation.
-
Undocumented
Declaration
Objective-C
+ (PTFileAttachment*)CreateFileAttchWithPath: (PTSDFDoc*)doc pos: (PTPDFRect*)pos path: (NSString *)path icon_name: (PTFileIcon)icon_name;
Swift
class func createFileAttch(withPath doc: PTSDFDoc!, pos: PTPDFRect!, path: String!, icon_name: PTFileIcon) -> PTFileAttachment!
-
Return Value
the file specification that contains a file reference or the embedded file data stream.
-
Sets the file specification.
Declaration
Objective-C
- (void)SetFileSpec:(PTFileSpec *)file;
Swift
func setFileSpec(_ file: PTFileSpec!)
Parameters
file
The file specification to associate with this annotation.. The file specification contains a file reference or the embedded file data stream.
-
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.
Declaration
Objective-C
- (BOOL)Export:(NSString *)save_as;
Swift
func export(_ save_as: String!) -> Bool
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().
Return Value
true is the file was saved successfully, false otherwise.
-
Note
The annotation dictionary’s appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.Return Value
the type the associated icon style. @default e_PushPin
-
Sets the icon style associated with FileAttachment annotation. (Optional)
Note
The annotation dictionary’s appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.Parameters
type
icon style. @default e_PushPin
-
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.
Note
The annotation dictionary’s appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.
Declaration
Objective-C
- (NSString *)GetIconName;
Swift
func getIconName() -> String!
Return Value
A string denoting the name of the icon.
-
Sets the name of the icon associated with the FileAttachment annotation. (Optional)
Note
this method should be used to assign non-standard icon type to the annotation.See
SetIcon()Note
The annotation dictionary’s appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer.Declaration
Objective-C
- (void)SetIconName:(NSString *)iname;
Swift
func setIconName(_ iname: String!)
Parameters
iname
A string.denoting the name of the icon.