html2canvas to render document PDF with css styling using angular2/typescript

后端 未结 5 732
情话喂你
情话喂你 2021-01-02 05:24

How to generate an output file PDF using html2canvas with angular2

I tried to import the file html2canvas typescript and made a declaration like this to use it

5条回答
  •  囚心锁ツ
    2021-01-02 06:10

    If you are using Angular 4 you can include html2canvas under scripts list in .angular-cli.json as below

    "scripts": [
        "../node_modules/html2canvas/dist/html2canvas.min.js"
    ]
    

    After that import it in your class as below

    import * as html2canvas from "html2canvas"
    

    and then use it in your functions as below

    html2canvas(parameters);
    

提交回复
热议问题