简体   繁体   中英

How to get canvas object from kineticjs?

I'm working on an existing project which uses Kinetic.js to generate base64 dataUrl from canvas. (now I can export this dataUrl to png/jpg perfectly)

I also need to export content on canvas to PDF file. I'm using jsPDF for this.

The problem is jsPDF doesn't work properly when the content of canvas is spread on multiple pages.

I found a solution for this here: https://github.com/MrRio/jsPDF/issues/434#issuecomment-249697715

That's why I need to get canvas from kinetic dataURL in order to retrieve canvas.width, canvas.height

Do you have any idea on this? Thank you very much.

var nativeCanvas = layer.getCanvas()._canvas;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM