AddLinkToEmbeddedFile
Document properties, Annotations and hotspot links
Description
Adds a FileAttachment annotation rectangle to the selected page and links it to an embedded file already stored in the document.
Call AddEmbeddedFile first to copy the file bytes into the PDF and obtain the EmbeddedFileID. AddLinkToEmbeddedFile creates the page annotation, writes the attachment title and popup contents, and points the annotation at that embedded file specification.
PDF version behavior: FileAttachment annotations and embedded file streams require PDF 1.3. The annotation appearance generated by this function can include annotation opacity through /CA and transparency resources, which require PDF 1.4. If the current document version is lower and the save version is not locked, AddLinkToEmbeddedFile automatically raises the document to PDF 1.4 and records /CA annotation opacity in AutoBumpedFeatures. If the caller locks a lower save version, the compatibility gate rejects the save with LastErrorCode 602.
Syntax
Delphi
function TPDFlib.AddLinkToEmbeddedFile(Left, Top, Width, Height: Double; EmbeddedFileID: Integer; const Title, Contents: WideString; IconType, Transparency: Integer): Integer;ActiveX
Function PDFlib::AddLinkToEmbeddedFile(Left As Double, Top As Double, Width As Double, Height As Double, EmbeddedFileID As Long, Title As String, Contents As String, IconType As Long, Transparency As Long) As LongDLL
int DLAddLinkToEmbeddedFile(int InstanceID, double Left, double Top, double Width, double Height, int EmbeddedFileID, wchar_t * Title, wchar_t * Contents, int IconType, int Transparency);Parameters
| Left | The horizontal coordinate of the left edge of the annotation rectangle. |
|---|---|
| Top | The vertical coordinate of the top edge of the annotation rectangle. |
| Width | The annotation rectangle width. |
| Height | The annotation rectangle height. |
| EmbeddedFileID | The value returned by AddEmbeddedFile. |
| Title | The attachment title shown by the PDF viewer. |
| Contents | The text shown in the annotation popup. |
| IconType | The annotation icon: 0 = PushPin, 1 = disk image, 2 = no icon, 3 = graph, 4 = paperclip, 5 = tag, 6 = solid white rectangle. |
| Transparency | The transparency percentage from 0 to 100. Zero is fully opaque; 100 makes the icon invisible. |
Return values
| 0 | The EmbeddedFileID is invalid, no page is selected, or no document is active. |
|---|---|
| 1 | The FileAttachment annotation was created successfully. |
See also
AddEmbeddedFile, AddFileAttachment, EmbedFile, SetEmbeddedFileAFRelationship, EmbeddedFileCount