/// <summary> /// Performs an entire recalculation of the document flow, taking into /// account all its current child elements. /// </summary> /// <remarks> /// Performs an entire recalculation of the document flow, taking into /// account all its current child elements. May become very /// resource-intensive for large documents. /// <p> /// Do not use when you have set /// <see cref="RootElement{T}.immediateFlush"/> /// to <code>true</code>. /// </remarks> public virtual void Relayout() { if (immediateFlush) { throw new InvalidOperationException("Operation not supported with immediate flush"); } while (pdfDocument.GetNumberOfPages() > 0) { pdfDocument.RemovePage(pdfDocument.GetNumberOfPages()); } rootRenderer = new DocumentRenderer(this, immediateFlush); foreach (IElement element in childElements) { rootRenderer.AddChild(element.CreateRendererSubTree()); } }