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

DynaPDF.AttachFileText

Attaches a file to the document.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 6.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.AttachFileText"; PDF; Text; TextEncoding; FileName { ; Description; Compress } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Text The text content for the file. $xml
TextEncoding The text encoding for the text.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"UTF-8"
FileName The file name to display in PDF viewer. "ZUGFeRD-invoice.xml"
Description The description for the file. "invoice.xml" Optional
Compress Pass 1 to compress or 0 to not compress.
You should pass 1 for text data like XML or JSON.
0 Optional

Result

Returns OK or error.

Description

Attaches a file to the document.
The description is optional, the parameter can be set to "". The embedded file is compressed if the parameter Compress is set to 1. Otherwise it is left uncompressed. It is not always useful to compress embedded files especially if the file is already compressed, e.g. Zip files or already compressed image formats require no further compression. In the worst case the compressed file becomes larger as the uncompressed version. However, text files and most document formats should be compressed to reduce the file size.

For ZUGFeRD and Factor-X, please use this file names:
  • ZUGFeRD 1.x: "ZUGFeRD-invoice.xml"
  • ZUGFeRD 2.x: "zugferd-invoice.xml"
  • Factur-X / ZUGFeRD 2.1: "factur-x.xml"
  • XRechnung: "xrechnung.xml"

See also AttachFileText function in DynaPDF manual.

Examples

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 16th December 2015, last changed 12nd February 2021


DynaPDF.AttachFileContainer - DynaPDF.BeginContinueText