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 in HTML by Deepak
• 940 points
135 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 in HTML by Tejashwini
• 1,960 points
110 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 in HTML by Tejashwini
• 1,960 points
38 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 in HTML by Tejashwini
• 1,960 points
35 views
0 votes
0 answers

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

Can somebody explain why my video won't ...READ MORE

Jul 19 in HTML by Tejashwini
• 1,960 points
717 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 in HTML by Ashwini
• 1,160 points
31 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 in HTML by Ashwini
• 1,160 points
34 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 in Java-Script by Kichu
• 19,040 points
363 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
237 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
842 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
263 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