简体   繁体   中英

JS, save svg to png error with xlink:href

I try to save svg to png in client side. Follow this instruction http://techslides.com/save-svg-as-an-image/ It can save fine if not have img in svg or img not have attributes xlink:href. Error:

This page contains the following errors:

error on line 1 at column 215: Namespace prefix xlink for href on image is not defined
Below is a rendering of the page up to the first error.

Anyone have experience, plz help me!

You could add the xlink namespace since that's what the error suggests. In d3 that would be:

.attr("xmlns:xlink", "http://www.w3.org/1999/xlink")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM