muaz-khan / Canvas-Designer

Collaborative, extendable, JavaScript Canvas2D drawing tool, supports dozens of builtin tools, as well as generates JavaScript code for 2D animations.
https://www.webrtc-experiment.com/Canvas-Designer/
MIT License
367 stars 171 forks source link

Add pdf question #38

Open sanpangzi opened 6 years ago

sanpangzi commented 6 years ago

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.

muaz-khan commented 6 years ago

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.

sanpangzi commented 6 years ago

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

jonatap2chat commented 5 years ago

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

sanpangzi commented 5 years ago

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

jonatap2chat commented 5 years ago

Hi, thankyou so much for the reply.

Great I have just been looking at JavaScript or node js libraries, interesting about php ones.

And then what do you use to convert them back after annotation in canvas may I ask?

Any code example would be much appreciated.

Thankyou very much!

Jon On Wed, 18 Jul 2018 at 02:10, qian_hai_zhen notifications@github.com wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/muaz-khan/Canvas-Designer/issues/38#issuecomment-405776641, or mute the thread https://github.com/notifications/unsubscribe-auth/AknpyVAcac2laLoPfcK13HwyceALjOt4ks5uHorwgaJpZM4RE8Rc .

-- -- Regards Jon

Jon Hunter

Chief Technical Officer E: jon@atap2chat.com w: www.atap2chat.com

sanpangzi commented 5 years ago

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

jonatap2chat commented 5 years ago

Hi,

Thankyou so much great documentation and code really appreciate it.

One last question, any recommendation for converting back to pdf and saving after drawing on canvas?

Thankyou so much!

Jon On Wed, 18 Jul 2018 at 02:53, qian_hai_zhen notifications@github.com wrote:

First install the php library on your server, and use the follow code convert: [image: _20180718094058] https://user-images.githubusercontent.com/15684202/42854509-bdbbe0a4-8a6e-11e8-8ef0-8427572bd417.png and you can see the results on server as follow: [image: 222] https://user-images.githubusercontent.com/15684202/42854587-0ceabdda-8a6f-11e8-9bb8-595b73f98228.png 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 [image: 333] https://user-images.githubusercontent.com/15684202/42854706-b87a64ca-8a6f-11e8-834f-64d79dcad262.png third import the image by url as follow: [image: 444] https://user-images.githubusercontent.com/15684202/42854796-2d91fbe2-8a70-11e8-96a7-a278656918e6.png [image: 666] https://user-images.githubusercontent.com/15684202/42854799-2fd205b4-8a70-11e8-8b9a-43516f008bed.png [image: 777] https://user-images.githubusercontent.com/15684202/42854853-5ad5384e-8a70-11e8-9fd5-b47916ab77a7.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/muaz-khan/Canvas-Designer/issues/38#issuecomment-405783221, or mute the thread https://github.com/notifications/unsubscribe-auth/AknpydHWnnzueW0lcViKGzcHzJg7wFvJks5uHpUCgaJpZM4RE8Rc .

-- -- Regards Jon

Jon Hunter

Chief Technical Officer E: jon@atap2chat.com w: www.atap2chat.com

ph4t0o0o0om commented 5 years ago

@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

ph4t0o0o0om commented 5 years ago

Please help me :(