How to Add Hyperlink with Jspdf?

Is it possible to add HyperLink in jsPDF?

Here is my code which I am using for the same.

    var doc = new jsPDF('p', 'pt'); 
    doc.fromHTML(
     '<a href="">Click Here</a>',
     35,
     25,
     {
         'width': 180, 'elementHandlers': elementHandler
     });
     doc.save("info.pdf");
1

1 Answer

I got the solution after sicking from last two hours. there is also a method in jsPDF which is not so popular i.e.

doc.textWithLink('Click here', x, y, { url: ' });

Hope it will help someone :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest