Comments (10)
Please do.
On Jul 11, 2014, at 7:15 PM, PjotrC [email protected] wrote:
As I first tried your script, it worked pretty well. But now, after I edited my svg file a lot, it did stop working. Unfortunately there are no error messages. Can I post here a link to the problematic svg or my website?
—
Reply to this email directly or view it on GitHub.
from savesvgaspng.
Ok, here is the problematic svg:
https://dl.dropboxusercontent.com/u/17823304/Climograph/Climograph%20Davos.svg
And on that site I've got your script:
https://dl.dropboxusercontent.com/u/17823304/Climograph/Climograph_test.html
from savesvgaspng.
Hi exupero, do you see the problem and can you fix it? Or is there something I can do?
I removed the patterns and clipPaths from my script, that creates the svg, but still it das not work.
These were the things, which I added to, before it stopped working.
Another thing, which differs to my previous SVGs is, that I now use paths with cubic Bézier curves.
I removed them too. And also the indenting, but still its not working.
The only other thing, which I've added are tags - can this be the reason?
from savesvgaspng.
The problem is caused by the <br/>
tags within the <title>
tags. Use the HTML entity 
instead.
from savesvgaspng.
Ok, I am using that entity now - but still it is not working.
from savesvgaspng.
Are you using the latest version of the script?
Using the Sandbox on the test page, I was able to render the following PNG from your updated SVG code:
from savesvgaspng.
Have you changed something in the last 24h? Anyway, I just downloaded your script again.
Its odd, I tried my new svg (tags replaced with entity) with your index.html demo page and it worked. - But it does not on my page. But it works with my old svg. Please try yourself:
https://dl.dropboxusercontent.com/u/17823304/Climograph/Climograph_old.html (creates the old svg)
https://dl.dropboxusercontent.com/u/17823304/Climograph/Climograph_test.html (creates the new svg)
The code used to call saveSvgAsPng is the same in both versions, the only difference is the svg itself.
Also: After clicking the "save as png file" link, the page seems to be reloaded. You can see this, by changing a value in the table before clicking the link. Afterwards the value is changed back to its initial value (under Chrom - Firefox does remember the user inputs).
from savesvgaspng.
Your code is saving the contents of the first child of the #svgContainer
element, which in your new code is an HTML comment. The old SVG lacks the comment and therefore saves fine.
The page reload is due to the link and isn't related to this library. You can change the href
value to #
to prevent reloading.
from savesvgaspng.
Arg... I never thought that comments are added to the DOM structure.
Thanks a lot for pointing all this out!
from savesvgaspng.
I wouldn't have guessed it either. Glad it's working for you.
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
- use to generate PNG on server? (solved: using sharp.js instead) HOT 2
- 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.