Table of Contents

Method FlattenControls

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

FlattenControls()

Flattens all controls in the document. In effect, replaces controls with their appearance. Putting it differently, merges controls down on to their respective pages.

public void FlattenControls()

Remarks

Flattening locks controls from editing. Flattening can significantly reduce file size if RemoveUnusedObjects property is set to true.

This method enumerates all controls in the document and flattens every control in 2 steps:

  1. Draws the control on its parent page using text and vector graphics operators.
  2. Removes the control from the Widgets and Controls collections of its parent page.

This method flattens controls only. To flatten both controls and annotations (widgets), use the FlattenWidgets() method. To flatten only certain widgets or controls, process them individually using the Flatten() method.

The method won't draw anything for invisible controls or controls without a parent page. The control visibility is controlled by the Hidden and NoView properties. Controls without an appearance stream are also invisible.

This method can change graphics state of the page. To avoid possible side effects, call the method right before saving of the document.

See Also