@polotno/svg-import
v0.2.0
Published
Convert SVG files into editable Polotno JSON designs with separate text, images, and vector elements in the browser
Readme
@polotno/svg-import — SVG to editable Polotno JSON
Convert an SVG file into separate text, image, and vector elements in Polotno design JSON.
Works without the editor. The converter returns plain Polotno design JSON.
Runtime: Browser only. The importer needs browser DOM APIs.
Documentation · Try SVG to JSON in your browser
License: Non-production use is free, with no time limit. Production use requires a valid Polotno subscription. Read the license.
Use this package when you need editable design elements from an SVG. Text that the source stores as paths remains vector artwork and cannot become editable text.
Installation
npm install @polotno/svg-importUsage
import { svgToJson } from '@polotno/svg-import';
const svg = `<svg viewBox="0 0 800 600">
<text x="100" y="100" font-size="24">Hello World</text>
<rect x="200" y="200" width="100" height="100" fill="blue"/>
</svg>`;
const json = await svgToJson({ svg });
// Optional: load the design into a Polotno store.
store.loadJSON(json);