Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Associates an embedded file with a PDF object.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 6.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.AssociateEmbFile"; PDF; DestObject; DestHandle; Relationship; EmbFile )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
DestObject The destination object type.
Can be Annotation, Catalog, Field, Image, Page or Template.
DestHandle The destination object handle or -1. -1
Relationship The relationship for the object to its parent.
Can be Associated, Data, Source, Supplement or Alternative.
The value Alternative must be used for ZUGFeRD compatible invoices.
EmbFile Handle of an embedded file.


Returns OK or error.


Associates an embedded file with a PDF object.
The parameter DestHandle must be a valid handle of a PDF object. If destination object type is a page, then the page number must be used as handle. The first page is denoted by one. If the destination object is the documents catalog then the parameter DestHandle is ignored. Set the parameter to zero or -1 in this case.
The parameter EmbFile must be a valid handle of an embedded file. See DynaPDF.AttachFile or AttachFile for further information.
Associated files are supported since PDF 2.0 and in PDF/A 3 files. In PDF/A 3 files all embedded files must be associated with a PDF object.

See also AssociateEmbFile function in DynaPDF manual.


Add ZUGFeRD invoice xml file:

Set Variable [$FileHandle; Value:MBS("DynaPDF.AttachFileText"; $pdf; ZUGFeRD Invoice::Invoice XML; "UTF-8"; "ZUGFeRD-invoice.xml"; "Invoice as XML")]
Set Variable [$r; Value:MBS("DynaPDF.AssociateEmbFile"; $pdf; "Catalog"; -1; "Alternative"; $FileHandle)]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 15th December 2015, last changed 16th August 2016

DynaPDF.ApplyShading - DynaPDF.AttachFile