How to show a subsection or “slice” of an SVG chart?

Is there a way to cut SVG. I mean any existing lib library. I need to implement this slicing component in Java.

I mean, I have a single SVG file and the rulers / scales that I select graphically, I want to cut a single SVG into different SVG files.

I hope I understand.

+3
java slice image vector-graphics svg
source share
3 answers

Yes, although one might think that this is classified information - or simply simply impossible - based on how difficult it is to find this basic fact ....

Apparently all you have to do is reference the viewBox from the URI fragment. . I confirmed that it really works. Take the following example ... A history lesson, 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

+5
source share

If you work with SVG in Java, the Batik SVG Toolkit will provide a lot of functionality (I admit I don’t know what you mean by slicing, however)

0
source share

All you have to do is edit the <svg> . Change the width and height , set the viewBox attribute in the main svg element to the rectangle you want, render, repeat.

Each svg will contain all the data from the original, but will only display part of the drawing inside the viewBox . See http://dingoskidneys.com/~dholth/svg/

 viewbox = "xy width height" 
0
source share

All Articles