Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.0   11.1   11.2   11.3   11.4   11.5   12.0   12.1   12.2   12.3    Statistic    FMM    Blog  


Associates an embedded file with a PDF object.

Component Version macOS Windows Linux Server iOS SDK License
DynaPDF 6.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes Paid
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

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

DynaPDF.ApplyShading - DynaPDF.AttachFile

Feedback: Report problem or ask question.

Start Chat