Generate pdf from HTML in div using Javascript

0 votes

I have the following HTML code:

<!DOCTYPE html>
<html>
    <body>
        <p>don't print this to pdf</p>
        <div id="pdf">
            <p><font size="3" color="red">print this to pdf</font></p>
        </div>
    </body>
</html>

All I want to do is to print to pdf whatever is found in the div with an id of "pdf". This must be done using JavaScript. The "pdf" document should then be automatically downloaded with a filename of "foobar.pdf"

I've been using jspdf to do this, but the only function it has is "text" which accepts only string values. I want to submit HTML to jspdf, not text.

Aug 10, 2022 in HTML by Deepak
• 980 points
1,366 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
0 answers

How to do calculations in HTML forms using JavaScript?

I'm developing a straightforward app that multiplies ...READ MORE

Jul 26, 2022 in HTML by Tejashwini
• 3,820 points
1,595 views
0 votes
0 answers

How to insert spaces/tabs in text using HTML/CSS

how to add space in HTML except ...READ MORE

Jun 3, 2022 in HTML by Tejashwini
• 3,820 points
384 views
0 votes
0 answers

How to remove a underline from a link in HTML?

how to remove the underline from a ...READ MORE

Jul 5, 2022 in HTML by Tejashwini
• 3,820 points
514 views
0 votes
2 answers

How to play video in react.js using html video tag?

This is a solution: import Video from "..Videos/video1.mp4" class ...READ MORE

answered May 21, 2023 in HTML by Renie
7,306 views
0 votes
0 answers

How to extract img src, title and alt from html using php?

I want to make a page listing ...READ MORE

Jul 21, 2022 in HTML by Ashwini
• 5,430 points
617 views
0 votes
0 answers

How to use <form:form> </form:form> TAG using HTML in Spring MVC?

How to utilize the <form:form> </form:form> In Spring MVC ...READ MORE

Jul 26, 2022 in HTML by Ashwini
• 5,430 points
398 views
0 votes
0 answers

Generate pdf from HTML in div using Javascript

This is my HTML code: <!DOCTYPE html> <html> ...READ MORE

May 9, 2022 in Java-Script by Kichu
• 19,040 points
972 views
0 votes
0 answers

Generate pdf from HTML in div using Javascript

I have the following HTML code: <!DOCTYPE html> <html> ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
1,017 views
0 votes
1 answer

Presenting docket dtates inside html page by javascript

Use the Docker Engine Api:Docker Engine API ...READ MORE

answered Jun 20, 2018 in Docker by DareDev
• 6,890 points
764 views
0 votes
1 answer

Migrating proxy npm repo in nexus 3

I don't think you can achieve this ...READ MORE

answered Jun 22, 2018 in DevOps Tools by DareDev
• 6,890 points
1,538 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP