AddAssociatedFileFromFile
Associated files, attachments, file input
Description
Embeds a file once, adds it to the /EmbeddedFiles name tree, and registers the same file specification in the document catalogue /AF array
An empty DisplayName uses the source file name without its directory path
Syntax
Delphi
Function TPDFlib.AddAssociatedFileFromFile(Const FileName, DisplayName, MIMEType, Description, Relationship: WideString): Integer;ActiveX
Function PDFlib::AddAssociatedFileFromFile(FileName As String, DisplayName As String, MIMEType As String, Description As String, Relationship As String) As LongDLL
int DLAddAssociatedFileFromFile(int InstanceID, const wchar_t* FileName, const wchar_t* DisplayName, const wchar_t* MIMEType, const wchar_t* Description, const wchar_t* Relationship);
int DLAddAssociatedFileFromFileA(int InstanceID, const char* FileName, const char* DisplayName, const char* MIMEType, const char* Description, const char* Relationship);Parameters
| FileName | Path of an existing file to embed |
|---|---|
| DisplayName | Name shown for the embedded file; an empty value uses the source file name without its directory path, and the resulting title must not duplicate an existing embedded-file title |
| MIMEType | MIME type stored in the file specification; must not be empty |
| Description | Optional description stored in the associated-file entry; may be empty |
| Relationship | Relationship role, one of Source, Data, Alternative, Supplement or Unspecified |
Return values
Returns a nonzero embedded-file handle on success or 0 when validation or input fails
Remarks
Relationship must be Source, Data, Alternative, Supplement, or Unspecified
Associated files require PDF 1.7 and are rejected by PDF/A profiles that forbid embedded files
See also
AddAssociatedFileFromStream, GetAssociatedFileCount, AddRichMediaAnnotationFromEmbeddedFile