muaz-khan / Canvas-Designer

Collaborative, extendable, JavaScript Canvas2D drawing tool, supports dozens of builtin tools, as well as generates JavaScript code for 2D animations.

Home Page:https://www.webrtc-experiment.com/Canvas-Designer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add pdf question

sanpangzi opened this issue · comments

commented

Hi Muaz,
Now Canvas-Designer only can add image, I want to add other, such as PDF. Do you any advice? I am looking forward to your reply.

You can use javascript libraries (search-on-google) to convert PDF into images, and then import single or multiple images (DataURIs or Blobs) into the tool using image-tool methods (reuse button-click event to pass DataURI instead of selecting from system).

(pdf-based) JS libraries may generate Canvas object. You can use canvas.toDataURL() to get images.

commented

Ok, thank you, Muaz, I will try it.

Hi guys, Did you manage to allow for import and export to pdf? I am just looking at it myself and be interested to hear if you made any progress. By the way Muaz-khan loving all your webrtc projects, awesome :) Jon

commented

I use php libraries imagick convert pdf to png,and use canvas.toDataURL() put them to canvas.

commented

First install the php library on your server, and use the follow code convert:
_20180718094058
and you can see the results on server as follow:
222
second on canvas, you can get these image according to path, as follow:
https://uploadt.dz101.com/uploadfiles/weiXinO2OpdfCourseware/2018/07/18/pdf749891531878335/1.png
333
third import the image by url as follow:
444
666
777

@sanpangzi hi i saw you comment . Now is your canvas support upload pdf function and sync in to other users and can draw on presentation? Please help me

Please help me :(