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 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 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 Long

DLL

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

LeftThe horizontal coordinate of the left edge of the annotation rectangle.
TopThe vertical coordinate of the top edge of the annotation rectangle.
WidthThe annotation rectangle width.
HeightThe annotation rectangle height.
EmbeddedFileIDThe value returned by AddEmbeddedFile.
TitleThe attachment title shown by the PDF viewer.
ContentsThe text shown in the annotation popup.
IconTypeThe annotation icon: 0 = PushPin, 1 = disk image, 2 = no icon, 3 = graph, 4 = paperclip, 5 = tag, 6 = solid white rectangle.
TransparencyThe transparency percentage from 0 to 100. Zero is fully opaque; 100 makes the icon invisible.

Return values

0The EmbeddedFileID is invalid, no page is selected, or no document is active.
1The FileAttachment annotation was created successfully.

See also

AddEmbeddedFile, AddFileAttachment, EmbedFile, SetEmbeddedFileAFRelationship, EmbeddedFileCount