public void FlattenWidgets()
Public Sub FlattenWidgets
Flattening locks widgets from editing. Flattening can significantly reduce file size if RemoveUnusedObjects property is set to true.
This method enumerates all widgets in the document and flattens every widget in 2 steps:
This method flattens both widgets (annotations) and controls. To flatten controls only, use the FlattenControls() method. To flatten only certain widgets or controls, process them individually using the Flatten() method.
The method won't draw anything for invisible widgets or widgets without a parent page. The widget visibility is controlled by the Hidden and NoView properties. Also, controls and some other widget types might be invisible if they do not provide an appearance stream.
This method can change graphics state of the page. To avoid possible side effects, call the method right before saving of the document.