Code Monkey home page Code Monkey logo

Comments (8)

azebac avatar azebac commented on May 18, 2024 2

Guys meanwhile if you are using angular2> you can use it by this way:
1.- Place all the .js in a folder in assets
2.- In the index.html:

<script src="assets/html2pdf/jspdf.min.js"></script>
<script src="assets/html2pdf/html2canvas.min.js"></script>
<script src="assets/html2pdf/html2pdf.js"></script>

3.- In your component at the imports section:
declare var html2pdf: any;

4.- And finally in your needed function:

   var element = document.getElementById('card-a4');
    new html2pdf(element, {
        margin:       0,
        filename:     'myfile.pdf',
        image:        { type: 'jpeg', quality: 0.98 },
        html2canvas:  { dpi: 192, letterRendering: true },
        jsPDF:        { unit: 'mm', format: 'a4', orientation: 'p' }
    });

from html2pdf.js.

eKoopmans avatar eKoopmans commented on May 18, 2024 1

Hey @keshav1007, sure thing, I'm working on it!

from html2pdf.js.

eKoopmans avatar eKoopmans commented on May 18, 2024 1

Okay everyone, the NPM package is done and delivered with the new v0.8.0! You can use it with npm install html2pdf.js (note the .js in the name, there was already an NPM package named html2pdf). Enjoy, and let me know if there's any issues!

P.S. As html2canvas points out, even though you can now use NPM/Node to build with this package, it will never work browserless in Node. Any package using html2pdf will need to run in the browser to work properly. You've been warned!

from html2pdf.js.

muathalbolushi avatar muathalbolushi commented on May 18, 2024

hey @eKoopmans I hope it is done as npm package, wanna use in my project.

from html2pdf.js.

keshav1007 avatar keshav1007 commented on May 18, 2024

Hi @eKoopmans is this ready?

from html2pdf.js.

MickaelBZH avatar MickaelBZH commented on May 18, 2024

An NPM package would be awesome.

from html2pdf.js.

keshav1007 avatar keshav1007 commented on May 18, 2024

@azebac thanks for this.. it is working properly but since i have some graphs/charts in my page those are not rendered properly.. do you have any solution for that?

from html2pdf.js.

eKoopmans avatar eKoopmans commented on May 18, 2024

Okay, stay tuned folks! I'll be dropping a new build in the next few days, rebuilt for NPM and all your require/include needs. Just need to work out the kinks.

from html2pdf.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.