Skip to content

Commit 12679ba

Browse files
committed
file to save svg
1 parent 3579c41 commit 12679ba

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/draw/svg.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export
77
SvgCanvas,
88
tosvg,
99
drawsvg,
10-
initcanvas!
10+
initcanvas!,
11+
savesvg
1112

1213
using Printf
1314

@@ -493,3 +494,17 @@ function drawwave!(canvas::SvgCanvas, seg, ucolor, vcolor)
493494
push!(canvas.elements, elem)
494495
return
495496
end
497+
498+
"""
499+
write svg string to file.
500+
"""
501+
function savesvg(the_svg_string::String, filename::String)
502+
if ! contains(filename, ".svg")
503+
filename *= ".svg"
504+
end
505+
506+
f = open(filename, "w")
507+
write(f, the_svg_string)
508+
close(f)
509+
return filename
510+
end

0 commit comments

Comments
 (0)