Skip to content

Conversation

@bgribaudo
Copy link

With this change, code like this becomes possible:

var pdf = new jsPDF();
pdf.addSVG(svgData, 25, 50, options);

In comparison, without this change, something along the lines of the below is required:

var pdf = new jsPDF();
svgElementToPdf(svgData, pdf, { x_offset: 25, y_offset: 50 });

Note
The method name "addSVG" conflicts with https://github.com/MrRio/jsPDF/blob/master/jspdf.plugin.sillysvgrenderer.js. This isn't a problem so long as we presume that the user will only use one SVG rendering plugin at a time.

With this change, code like this becomes possible:
    var pdf = new jsPDF();
    pdf.addSVG(svgData, 25, 50, options);

In comparison, currently something along the lines of the below is required:
    var pdf = new jsPDF();
    svgElementToPdf(svgData, pdf, options);

The method name "addSVG" conflicts with https://github.com/MrRio/jsPDF/blob/master/jspdf.plugin.sillysvgrenderer.js. This isn't a problem so long as we presume that the user will only use one SVG rendering plugin at a time.
@bgribaudo
Copy link
Author

I could take this a step further and wrap the entire body of svgToPdf.js code inside an anonymous function—as is commonly done with jsPDF plugins—if that would be desired.

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

Successfully merging this pull request may close these issues.

1 participant