开发者

Does anyone know how to save SVG to the web server using ASP.NET?

开发者 https://www.devze.com 2023-03-25 09:09 出处:网络
i have an SVG tag in my asp.net page which gets modified via javacript. once the image is set to the user\'s liking i\'d like the user to be able to save the SVG image to the web server via a button.

i have an SVG tag in my asp.net page which gets modified via javacript. once the image is set to the user's liking i'd like the user to be able to save the SVG image to the web server via a button. i'm not sure how to go about this. can anyone help me out with this? thanks.

below is the stripped-down html开发者_Go百科 on the page to give an idea of what i mean:

<body> 
<form id="form1" runat="server"> 
<svg> 
..svg content... 
</svg> 
</form> 
</body>


I'm not to familiar with svg, but if you're using javascript to manipulate, can you get javascript to give you it as a string, stuff it in an hidden input and post it to the server? jQuery may be able to find the container it's in and use html() to get it.

Simon


simon, you put me on the right track:

i got it to work by using jquery-svg (http://keith-wood.name/svg.html) to parse the svg and write to a hidden input. i then created an .ashx handler to take the hidden input value on submission and save as a .jpg to the web server. i used the batik svg toolkit (http://xmlgraphics.apache.org/batik/download.cgi) to convert from the svg content to .jpg format.

thanks to all!

0

精彩评论

暂无评论...
验证码 换一张
取 消