How to use Canvg javascript library offline in a browser without server?

58 views Asked by At

I'm developing a Firefox extension and for security issues I need to use Canvg offline, in a browser without server. I would like to use it in a pure js script. I have read the documentation but there isn't information about it. Could you kindly help me? Thank you all.

I tried to export the project from github (https://github.com/canvg/canvg.git) and to import it in my project, but not work...

1

There are 1 answers

0
André Fiedler On

I got it working:

  • download latest release (Source code (zip)) from here: https://github.com/canvg/canvg/releases
  • unpack the zip and navigate to the folder
  • do a yarn install
  • run npm start
    • this will create /dist/umd.js
  • take a look at /test/browser/index.html[1] on how to use it locally / offline

[1] https://github.com/canvg/canvg/blob/master/test/browser/index.html