Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a subsection or "slice" of an SVG graphic?

Is there any way to slice an SVG . I mean any already available lib . I need to implement this slicing component in Java.

I mean , I have single SVG file and based rulers/scales i choose graphically , I want to slice the single SVG into different SVG files.

Hope I am clear

like image 208
Jijoy Avatar asked Sep 06 '25 11:09

Jijoy


1 Answers

Yes, although, you'd think this was classified information - or just simply impossible - based on how hard it is to find this basic fact....

Apparently, all you need to do is reference the viewBox from a URI "fragment".. I have confirmed, it does indeed work. Take the following example... The lesson of the story, in case you miss it, is... image.svg#svgView(viewBox(100,100,100,100))

image.svg is defined as <svg .... viewBox="0,0,400,400" width="400" height="400">

http://example.com/image.svg

svg linked with no viewBox attribute

http://example.com/image.svg#svgView(viewBox(100,100,100,100))

enter image description here

like image 66
Alex Gray Avatar answered Sep 09 '25 18:09

Alex Gray