Skip to content

vyaz-monorepo / renderers/src / renderResultToSVG

Function: renderResultToSVG() ​

renderResultToSVG(result, options?): string

Defined in: renderers/src/SVGRenderer.ts:1473

Render a ParagraphLayoutResult to SVG, auto-passing dimensions.

Uses result.width and result.height as the SVG canvas size. This is the recommended way to render when you have a layout result and want sizing: 'frame' with correct dimensions.

Parameters ​

result ​

ParagraphLayoutResult

— layout result from ParagraphLayoutEngine.layout()

options? ​

SVGRenderOptions

— rendering options (preset, style, fit, etc.)

Returns ​

string

SVG string

Example ​

ts
const result = paragraphLayoutEngine.layout(paragraph, 300);
const svg = renderResultToSVG(result, { preset: 'preserve' });

Released under the MIT License.