jsPDF can't get any styling to work

后端 未结 4 794
迷失自我
迷失自我 2020-11-27 05:17

I\'m new to using jsPDF but and for the life of me I can\'t get any css to apply to this thing! I\'ve tried inline, internal, and external all to no avail! I read in another

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 06:00

    you can try this option, that uses jsPDF, html2canvas and html2pdf libraries

    from its README:

    include this files:

    
    
    
    

    and then you can generate your pdf by running:

    html2pdf($('body').get(0), {
       margin:       1,
       filename:     'myfile.pdf',
       image:        { type: 'jpeg', quality: 0.98 },
       html2canvas:  { dpi: 192, letterRendering: true },
       jsPDF:        { unit: 'in', format: 'letter', orientation: 'portrait' }
    });
    

提交回复
热议问题