canvas2pdf icon indicating copy to clipboard operation
canvas2pdf copied to clipboard

Can we use existing canvas created by another library?

Open sinanerdem opened this issue 6 years ago • 5 comments

For example, fabric.js can create a canvas. Can I use this canvas or somehow convert to mock canvas used by canvas2pdf in order to create a pdf from it?

sinanerdem avatar Nov 20 '18 13:11 sinanerdem

I'd like to know that also.

wmerussi avatar Jan 28 '19 15:01 wmerussi

Any update ?

sagarvibrant avatar Oct 06 '19 11:10 sagarvibrant

I like to know that also. Can i load JSON exported in fabric into canvas2pdf canvas (mock)?

nistaneznam avatar Oct 15 '19 06:10 nistaneznam

Since this was asked more than a year ago and no reply has been made, I can only assume that it is not possible. Has anyone found a good alternative? I am using fabric.js as well.

6Hat avatar Dec 25 '19 16:12 6Hat

I was looking for this, but found that it is possible to save a canvas as a png or jpg using toDataURL (see https://stackoverflow.com/questions/923885/capture-html-canvas-as-gif-jpg-png-pdf). Then you'd use PDFKit to display the canvas as an image using the image loading described here: https://pdfkit.org/docs/images.html

ramonakira avatar Dec 17 '21 10:12 ramonakira