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.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Flatten annotations.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 4.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
Flags | The flags as text or number. Default is None. Can be None, UseViewState, MarkupAnnots or both combined as VisibleMarkupAnnots. |
"UseViewState" |
Returns number or error message.
Flag Name | Flag Number | Description |
None | 0 | Printable annotations independent of type. |
UseViewState | 1 | If set, annotations which are visible in a viewer become flattened. |
MarkupAnnots | 2 | If set, markup annotations are flattened only. Link, Sound, or FileAttach annotations are no markup annotations. Such types will be left intact. |
NonPDFA_1 | 4 | If set, flatten all annotations which are not supported in PDF/A 1. |
NonPDFA_2 | 8 | If set, flatten all annotations which are not supported in PDF/A 2 or 3. |
FormFields | 16 | If set, form fields will be flattened too. |
UseFieldViewState | 32 | Meaningful only if affFormFields or affSigFields is set. If set, flatten the view state of form fields. Use the print state otherwise. |
SigFields | 64 | Meaningful only if affFormFields is not set. If set, signature fields with an appearance stream will be flattened. |
KeepLinkAnnots | 4096 | If set, link annotations will be kept. |
KeepFileAttach | 8192 | If set, file attachment annotations will be kept. |
KeepTextAnnots | 16384 | If set, text annotations will be kept. |
KeepEmptySigFields | 32768 | If set, signature fields which are not already signed will be kept. |
PreserveZOrder | 4194304 | If 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.
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) ]
Created 18th August 2014, last changed 27th February 2021
DynaPDF.FlattenAnnotOrField - DynaPDF.FlattenForm
Feedback: Report problem or ask question.