Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG Export broken on main Paperjs.org site, and elsewhere #1945

Closed
Robbbb opened this issue Aug 28, 2021 · 4 comments
Closed

SVG Export broken on main Paperjs.org site, and elsewhere #1945

Robbbb opened this issue Aug 28, 2021 · 4 comments

Comments

@Robbbb
Copy link

Robbbb commented Aug 28, 2021

Description/Steps to reproduce

SVG Export broken on main Paperjs.org site as well as other places which use that code, such as my Ruler Genrator.
Go to Paperjs.org, click features, scroll to SVG export section, click Download as SVG

Link to reproduction test-case

Paper JS Main Site

Expected result

Download SVG
Error: 500 Server Error
The server encountered an error and could not complete your request.
URL of error: https://download-data-uri.appspot.com/

Additional information

@eeropic
Copy link
Member

eeropic commented Sep 8, 2021

Hi @Robbbb !
Good catch - the implementation is pretty old, and I assume from times before you could natively create a Blob and
download it without a third-party provider.

http://sketch.paperjs.org/ implements this directly via exporting the project as SVG string and using it in a Blob as URL

Here's an example you could use for your Ruler Generator

https://codepen.io/eeropic/pen/powRWpM

let downloadLink = document.getElementById('downloadSVG')
let svgString = paper.project.exportSVG({asString:true})
var url = URL.createObjectURL(
    new Blob(
        [svgString], 
        {type: 'image/svg+xml'}
    )
);
downloadLink.href = url
downloadLink.download = 'myPaperExport.svg';

@Robbbb
Copy link
Author

Robbbb commented Sep 18, 2021

@eeropic wow, thank you so much!!

Without your help I never would have figured this out.
I really appreciate it!

@Robbbb Robbbb closed this as completed Sep 18, 2021
@Robbbb
Copy link
Author

Robbbb commented Sep 18, 2021

Oops, while I solved it using your fiddle for Ruler Generator, the error remains on the main Paper.Js site

@Robbbb Robbbb reopened this Sep 18, 2021
@eeropic
Copy link
Member

eeropic commented Sep 20, 2021

Thanks, moving this issue to the Paper.JS site repository, and closing (as this repo is for the library itself)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants