Table of Contents

Method Flatten

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

Flatten()

Flattens this widget to its parent page. In effect, replaces the control with its appearance.

public void Flatten()

Remarks

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

This method flattens the widget in 2 steps:

  1. Draws the widget on its parent page using text and vector graphics operators.
  2. Removes the widget from the document and from the Widgets collection of its parent page. Controls are also removed from the Controls collection.

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.

NOTES:

  • Do not use this widget after successful flattening. The flattened control is detached from its document.
  • This method modifies Widgets and Controls collections so do not use the Flatten() method within foreach (var control in page.Controls) or foreach (var widget in page.Widgets) loops.
  • This method can change graphics state of the page. To avoid possible side effects, call the method right before saving of the document.

You can flatten all widgets and controls using the FlattenWidgets() method. To flatten only controls, use the FlattenControls() methods.

See Also