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: 9.4   9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1    Statistic    FMM    Blog  

DynaPDF.FlattenAnnots

Flatten annotations.

Component Version macOS Windows Linux Server FileMaker iOS SDK
DynaPDF 4.2 Yes Yes Yes Yes Yes
MBS( "DynaPDF.FlattenAnnots"; PDF; Flags )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Flags The flags as text or number.
Default is None. Can be None, UseViewState, MarkupAnnots or both combined as VisibleMarkupAnnots.
"UseViewState"

Result

Returns number or error message.

Description

Flatten annotations.
Draws all annotations according to the used flags on the corresponding pages and deletes the annotations when finish. The flatten flags can be combined. The flag MarkupAnnots causes that non-markup annotations will be left intact (all kind of link, sound, and file attach annotations).

The function flattens only annotations which contain an appearance stream. The function does not create missing appearances on demand.

If the function succeeds the return value is the number of annotations which are still in memory.

By default all annotations which have an appearance stream and which have the print flag set are flattened. All annotations are deleted when the function returns with the exception of file attachment annotations. If you want to flatten the view state then set the flag affUseViewState.

Flag NameFlag NumberDescription
None0Printable annotations independent of type.
UseViewState1If set, annotations which are visible in a viewer become flattened.
MarkupAnnots2If set, markup annotations are flattened only. Link, Sound, or FileAttach annotations are no markup annotations. Such types will be left intact.
NonPDFA_14If set, flatten all annotations which are not supported in PDF/A 1.
NonPDFA_28If set, flatten all annotations which are not supported in PDF/A 2 or 3.
FormFields16If set, form fields will be flattened too.
UseFieldViewState32Meaningful only if affFormFields or affSigFields is set. If set, flatten the view state of form fields. Use the print state otherwise.
SigFields64Meaningful only if affFormFields is not set. If set, signed signature fields will be flattened.
KeepLinkAnnots4096If set, link annotations will be kept.
KeepFileAttach8192If set, file attachment annotations will be kept.
KeepTextAnnots16384If set, text annotations will be kept.
KeepEmptySigFields32768If set, signature fields which are not already signed will be kept.
PreserveZOrder4194304If set, preserve the z-order under any circumstances. That means visible overlapping annotations or form fields will be flattened, regardless the type.

See also FlattenAnnots function in DynaPDF manual.

Examples

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

Example Databases

Blog Entries

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


DynaPDF.FlattenAnnotOrField   -   DynaPDF.FlattenForm

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins

Start Chat