Closed PjotrC closed 9 years ago
Please do.
On Jul 11, 2014, at 7:15 PM, PjotrC notifications@github.com 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.
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
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
The problem is caused by the <br/>
tags within the <title>
tags. Use the HTML entity 
instead.
Ok, I am using that entity now - but still it is not working.
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:
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).
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.
Arg... I never thought that comments are added to the DOM structure. Thanks a lot for pointing all this out!
I wouldn't have guessed it either. Glad it's working for you.
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?