AddLinkToEmbeddedFileA
Document properties, Annotations and hotspot links
Description
The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to AddLinkToEmbeddedFile and string arguments are interpreted using the current SetAnsiMode code page
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 behaviour: 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 DLAddLinkToEmbeddedFileA(InstanceID: Integer; Left, Top, Width, Height: Double; EmbeddedFileID: Integer; Title, Contents: PAnsiChar; IconType, Transpareny: Integer): Integer;
DLL
int DLAddLinkToEmbeddedFileA(int InstanceID, double Left, double Top, double Width, double Height, int EmbeddedFileID, const char * Title, const char * Contents, int IconType, int Transpareny);
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