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


Flatten forms.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.FlattenForm"; PDF )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf


Returns OK or error message.


Flatten forms.
Draws all form fields on the corresponding pages and deletes the form fields, incl. corresponding JavaScripts and JavaScript actions. The resulting PDF pages look after flattening as if the form were printed.
Note that this function does not support XFA forms. If the form is a hybrid form, the PDF form fields will be flattened. A maybe existing XFA form will be deleted but not flattened.
Fields, which are invisible for printing, due to an absent print flag, or if the hidden flag was set, are excluded from flattening. These fields are deleted without drawing them on the page.
This function is especially useful if a large amount of Interactive Forms (which are already filled out by the user) should be prepared for printing, or if the forms should be archived without allowing further changes. Flattened forms require less disk space and can be printed faster.

XFA Forms which are created by Adobe's Designer are not fully supported. Only hybrid forms can be flatted.

Requires DynaPDF Pro license.

See also FlattenForm function in DynaPDF manual.


Make all forms flat:

MBS( "DynaPDF.FlattenForm"; $PDF )

Flatten annotations and form fields:

# Initialize DynaPDF if needed
If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
    Perform Script [ Specified: From list ; “InitDynaPDF” ; Parameter: ]
End If
# New PDF environemnt
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; MyTable::Input PDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
# Flatten annotations
Set Variable [ $r ; Value: MBS( "DynaPDF.FlattenAnnots"; $PDF ) ]
# and the form fields
Set Variable [ $r ; Value: MBS( "DynaPDF.FlattenForm"; $PDF ) ]
# Save
Set Field [ MyTable::Output PDF ; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 29th October 2020

DynaPDF.FlattenAnnots - DynaPDF.FlushPages