PdfDocument.FlattenControls Method

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

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)


public void FlattenControls()
Public Sub FlattenControls


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 control on its parent page using text and vector graphics operators.
  2. Removes control from the Controls collection of its parent page.

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

Flattening of signature fields without appearance stream is not supported yet.

See Also