Search
 
SCRIPT & CODE EXAMPLE
 

HTML

javascript generate pdf from div content jquery

<!--html-->
<div id="content">
     <h3>Hello, this is a H3 tag</h3>

    <p>A paragraph</p>
</div>
<div id="editor"></div>
<button id="cmd">generate PDF</button>

<!--import the script-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.2.0/jspdf.umd.min.js"></script>

<!--the script-->
<script>
var doc = new jsPDF();
var specialElementHandlers = {
    '#editor': function (element, renderer) {
        return true;
    }
};

$('#cmd').click(function () {
    doc.fromHTML($('#content').html(), 15, 15, {
        'width': 170,
            'elementHandlers': specialElementHandlers
    });
    doc.save('sample-file.pdf');
});
</script>
Comment

PREVIOUS NEXT
Code Example
Html :: bootstrap height 100vh class 
Html :: & in html 
Html :: vertical break html 
Html :: font awesome cdn 
Html :: html skype call 
Html :: hamburger icon svg 
Html :: auto update copyright year javascript 
Html :: visualizador de pdf html5 
Html :: html image googe drive 
Html :: how to open a website inside a website 
Html :: no-gutter bootstrap 4 
Html :: how to add an audio in html 
Html :: youtube iframe autoplay not working 
Html :: how to make a link in hml 
Html :: html lazy loading images 
Html :: Add fav icon to browser tab 
Html :: how to put a table in the middle of a div in html 
Html :: external js 
Html :: html template 
Html :: input with dropdown 
Html :: how to change background in html 
Html :: tailwind 
Html :: Can I customize the Work Order Tablet View? I want all the buttons at the top. odoo 
Html :: nuxt paginate bootstrap 5 
Html :: iframe - Full Screen - HTML 
Html :: datatable tfoot renders after thead and before tbody 
Html :: select2 bootstrap modal issue 
Html :: What is the browser default background color for selected text 
Html :: displa text in html 
Html :: how to make a link in html that opens in a new tab 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =