0

How to make a bindingHandlers with jsPdf, I tried this example, but it does not work.

ko.bindingHandlers.generatePDF = {
    init: function(element) {

        function onClick() {
            var pdf = new jsPDF('p', 'pt', 'letter');
            pdf.canvas.height = 72 * 11;
            pdf.canvas.width = 72 * 8.5;

            pdf.fromHTML(document.body);

            pdf.save('test.pdf');                    
        };

        element.addEventListener("click", onClick);
    }
};
Beniamin H
  • 2,048
  • 1
  • 11
  • 17
  • 3
    `does not work` - does it throw exception? What are expected and actual behaviour? – Capacytron Jan 17 '19 at 13:05
  • Interesting... looks an awful lot like my [answer](https://stackoverflow.com/a/43300193/2421277) which is a function I'm still using in production today. Typically this belongs as a comment to the answer you referenced. Not a new question. – pim Jan 18 '19 at 10:00
  • Possible duplicate of [How to properly use jsPDF library](https://stackoverflow.com/questions/16858954/how-to-properly-use-jspdf-library) – pim Jan 18 '19 at 10:01

0 Answers0