Giter VIP home page Giter VIP logo

Comments (10)

exupero avatar exupero commented on July 1, 2024

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.

PjotrC avatar PjotrC commented on July 1, 2024

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.

PjotrC avatar PjotrC commented on July 1, 2024

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.

exupero avatar exupero commented on July 1, 2024

The problem is caused by the <br/> tags within the <title> tags. Use the HTML entity &#013; instead.

from savesvgaspng.

PjotrC avatar PjotrC commented on July 1, 2024

Ok, I am using that entity now - but still it is not working.

from savesvgaspng.

exupero avatar exupero commented on July 1, 2024

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:

test

from savesvgaspng.

PjotrC avatar PjotrC commented on July 1, 2024

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.

exupero avatar exupero commented on July 1, 2024

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.

PjotrC avatar PjotrC commented on July 1, 2024

Arg... I never thought that comments are added to the DOM structure.
Thanks a lot for pointing all this out!

from savesvgaspng.

exupero avatar exupero commented on July 1, 2024

I wouldn't have guessed it either. Glad it's working for you.

from savesvgaspng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.