We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I've been exporting my canvas using runemadsen's example code here: https://github.com/runemadsen/p5-svg-test
I want to use the most recent release of p5.js but unfortunately this code does not work:
ctx.prototype.getSerializedSvg = function(fixNamedEntities) {
var serialized = new XMLSerializer().serializeToString(this.__root);
return serialized;
}
var p5SVG = (function(){
p5.prototype.beginRecord = function () {
this.orgDrawingContext = this.drawingContext;
this.drawingContext = new C2S(this.drawingContext.canvas.clientWidth, this.drawingContext.canvas.clientHeight);
};
p5.prototype.endRecord = function () {
document.body.innerHTML += 'Exported SVG' + this.drawingContext.getSerializedSvg(true) + '';
this.drawingContext = this.orgDrawingContext;
};
})();
returns serialized as empty when using p5.js v0.4.22
It works fine in version p5.js v0.3.2
Any idea what changed?
thanks!
Answers
I just saw Zeno Zeng's work on update svg and pdf for recent versions: https://github.com/zenozeng/p5.js-pdf
Pretty incredible. I'll just use his stuff instead.