Comments (2)
Same here, trying to use with node but can't figure out how.
from savesvgaspng.
i wound up using sharp. it's faster, has no such dependencies. it's kinda finicky about you getting your SVG properly formatted, including the xmlns
and xmlns:xlink
. if i remember correctly, the sample svg below can be used to test sharp, in case your other examples fail. it took a bit of time for us to get this to happen. we needed a graph and an embedded image in our svg.
<svg width="200" height="230" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<path fill="white" stroke="steelblue" stroke-width="1.5" d="M0,0 L0,229 L199,229 L199,1 L0,0Z"></path><g transform="translate(5,5)"><image x="0" y="0" width="100" height="9" xlink:href=
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABgESAAMAAAABAAEAAAMBAAUAAAABAAAAVgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOw1ESAAQAAAABAAAOwwAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwYHBwgJCwkICAoIBwcKDQoKCwwMDAwHCQ4PDQwOCwwMDP/bAEMBAgICAwMDBgMDBgwIBwgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAAkAZAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwU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/rjN/wCnFa6KdVRhKLinfq+np/X4XT56tFznGak1y9O/r/T++zX2vYfsP/C+L/gurdeH10O9Gl23wutviDFZf29qBiTWz4jmBvdnn4z8ijYR5eFA244q1+2X+w18L/Gf/BW/4FaXqWg302n/ABT0Lxtq3ie2TXdQgi1a7tE0X7NIVjnUIYxPNgJtH7xuK+yIv+Tubn/sT4v/AEukpnjv/k7f4b/9i/4g/wDRul1znQfnl/wUR0zTfGv/AAVV8eWGvL8ENSstN+HfhZ7K2+JfxY1TwTFaPLe695jWS2cMouC2yPzdwUpthxne2N//AIKBeBpviL8bv2I/BXhHwr4P8eaNf+D/ABRNbeFT8Qr/AE/w/qkVtpmlGAw6pBbzS3Kxqf3MskI8wNuZo9xNZX/Bb7/k67w//wBija/+ll9X19+z/wD8i1+y/wD9iG//AKbrGmBw/wDwQksL6+/YTXxfLqbHSPiN4j1DxHo3hkX+oagnw9tmZLZ9AE98fOke2ura5MvyRxrPLMsabFVmK+hP2Xv+Sa6n/wBjd4n/APT9qFFID//Z"
/>
<g fill="none" font-size="10" font-family="sans-serif" text-anchor="middle" transform="translate(0, 25) scale(4.761904761904762,0.8) translate(0, 10)"><path fill="none" stroke="steelblue" stroke-width="1" d="M0,152L1,152 L2,126 L3,109 L4,97 L5,89 L6,84 L7,80 L8,76 L9,73 L10,71 L11,71 L12,71 L13,68 L14,67 L15,69 L16,121 L17,141 L18,157 L19,168 L20,177 L21,185 L22,193 L23,198 L24,202 L25,206 L26,209 L27,211 L28,213 L29,214 L30,216 L31,216 L32,216 L33,216 L34,216 L35,216 L36,216 L37,216 L38,216 L39,216 L40,216 M0,0Z"></path></g></g></svg>
from savesvgaspng.
Related Issues (20)
- when <svg> has <img>,con't show the imge in the png HOT 3
- Size of downloaded image varying according to the zoom level of browser HOT 1
- Only half of the SVG is rendered
- saveSvgAsPng without css styleSheets, modifyCss dosen`t work, who can tell me how to use modifyCss HOT 3
- saveSvgAsPng makes svg's image fill disappear (d3.js) HOT 9
- CSS rule breaks export? HOT 3
- i get this error ReferenceError: excludeUnusedCss is not defined HOT 1
- How to add a Google Font? HOT 3
- Uncaught (in promise) TypeError: Cannot read property 'width' of undefined at saveSvgAsPng.js:265 HOT 1
- ReferenceError: navigator is not defined (using Node.js) HOT 1
- How to use fonts in options parameter. HOT 3
- saveSvgAsPng is not capturing all the items inside svg tag
- HOW can i do, if the dataURl size > 2M
- some svgs not working on mobile safari
- Syntax error HOT 1
- svgAsPngUri working on browser but not android HOT 1
- Add/Update TypeScript type definitions
- HTMLElement or SVGElement in Chrome HOT 1
- problem with Canvg library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from savesvgaspng.