AddFileAttachmentA

Document properties

Description

O sufixo A indica o ponto de entrada ANSI (char) da DLL; a superfície ActiveX/COM expõe apenas a forma Unicode. O comportamento é idêntico ao de AddFileAttachment e os argumentos de cadeia de caracteres são interpretados com base na página de código atual definida por SetAnsiMode

Registers an existing embedded file as a document-level attachment in the PDF viewer. Readers that expose the Attachments panel show the supplied title and open the referenced embedded file when the user selects it.

Call AddEmbeddedFile first to copy the file bytes into the document and obtain the EmbeddedFileID. AddFileAttachment then adds that file specification to the Catalog /Names /EmbeddedFiles name tree without duplicating the embedded bytes.

PDF version behavior: AddEmbeddedFile emits embedded file stream and file specification dictionaries, which require PDF 1.3. Registering the file in the document-level /Names /EmbeddedFiles name tree requires PDF 1.4. If the current document version is lower and the save version is not locked, AddFileAttachment automatically raises the document to PDF 1.4 and records /EmbeddedFiles name tree in AutoBumpedFeatures. If the caller locks a lower save version, the compatibility gate rejects the save with LastErrorCode 602.

Syntax

Delphi

Function DLAddFileAttachmentA(InstanceID: Integer; Title: PAnsiChar; EmbeddedFileID: Integer): Integer;

DLL

int DLAddFileAttachmentA(int InstanceID, const char * Title, int EmbeddedFileID);

Parameters

TitleThe attachment name shown in the viewer and used as the key in the /EmbeddedFiles name tree. It must not be blank.
EmbeddedFileIDThe value returned by AddEmbeddedFile.

Return values

0The EmbeddedFileID is invalid, the title is blank, or no document is active.
1The embedded file was registered as a document-level attachment.

Remarks

This function creates a document-level attachment list entry. To place a clickable icon or hotspot on a page, use AddLinkToEmbeddedFile instead. To embed and register a file in one call, use EmbedFile.

See also

AddEmbeddedFile, AddLinkToEmbeddedFile, EmbedFile, SetEmbeddedFileAFRelationship, EmbeddedFileCount