I have this code from an svg image generated by the jquery barcode plugin.
" data:image/svg+xml,<svg%20xmlns="http://www.w3.org/2000/svg"%20version="1.1"%20width="115"%20height="65"><rect%20width="115"%20height="65"%20x="0"%20y="0"%20fill="#FFFFFF"%20/><rect%20width="1"%20height="50"%20x="10"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="12"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="15"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="18"%20y="0"%20fill="#000000"%20/><rect%20width="4"%20height="50"%20x="21"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="26"%20y="0"%20fill="#000000"%20/><rect%20width="3"%20height="50"%20x="29"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="33"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="35"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="40"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="45"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="47"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="50"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="54"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="56"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="58"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="60"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="63"%20y="0"%20fill="#000000"%20/><rect%20width="3"%20height="50"%20x="67"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="71"%20y="0"%20fill="#000000"%20/><rect%20width="3"%20height="50"%20x="74"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="79"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="81"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="85"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="88"%20y="0"%20fill="#000000"%20/><rect%20width="2"%20height="50"%20x="91"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="95"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="98"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="102"%20y="0"%20fill="#000000"%20/><rect%20width="1"%20height="50"%20x="104"%20y="0"%20fill="#000000"%20/><g%20transform="translate(57%200)"><text%20y="60"%20text-anchor="middle"%20style="font-family:%20Arial;%20font-size:%2010px;"%20fill="#000000">1234567890128</text></g></svg>"
and try to insert it in canvas as follows:
var img=new Image();
img.src='codigo svg';
ctx.drawImage(img,posX,posY);
but it throws me the following error:
unclosed token