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)

Syntax

C#
public void FlattenControls()
VB
Public Sub 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 control on its parent page using text and vector graphics operators.
  2. Removes control from the PdfDocument.Controls collection and the PdfPage.Controls collection of its parent page.

This method can change graphics state of the pages. Call it right before saving of the document to avoid side effects.

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

See Also