For more information, refer to SVG Rendering.
SvgDocument will create internal data structures to speed up rendering. This data can be cached and re-used by using SvgDocument.BeginRenderOptimize and SvgDocument.EndRenderOptimize.
If the SvgDocument will be rendered once, it is nest to leave the optimization as is. However, if the document will be rendered many times (for example, if it is being viewed in an Leadtools.Controls.ImageViewer control, then it is best to cache this data to enhance speed. This can easily be achieved by using BeginRenderOptimize before setting the document in the viewer.
BeginRenderOptimize can use extra system resources stored in the internal data. Use EndRenderOptimize to manually free this data at any time.
BeginRenderOptimize and EndRenderOptimize use an internal counter to track the state of the optimization. BeginRenderOptimize increments this counter and EndRenderOptimize decrements it: therefore, the optimization is only performed when needed and any number of BeginRenderOptimize and EndRenderOptimize operations can be chained together without affecting the document.
This internal data will be freed automatically when the document is disposed of, regardless of the value of the counter.
To determine whether the document has optimized rendering data, use SvgDocument.IsRenderOptimized.
For an example, refer to Render.