1. Create a Web page retrieving content from the various lists.
  2. Add a button called Export to PDF in an HTML file.
  3. Set the onclick event for the button, as shown below.
    1. <div>
    2. <br>
    3. <input type="button" id="exporttopdf" value="Export to PDF" onclick="exportSelectedItemsToPdf();" style="display:none;"/>
    4. <span> </span><input type="button" value="Print" id="print" style="display:none" onclick="PrintElem(this);" />
    5. </div>
  1. Here is the function representing linked to that button and gets executed when triggered.
    1. function exportSelectedItemsToPdf() {
    2. var documentPDF = new jsPDF();
    3. var caseid = $("#caseid_lb").text();
    4. var specialElementHandlers = {
    5. '#editor': function (element, renderer) {
    6. return true;
    7. }
    8. };
    9. documentPDF.fromHTML($('#tab-5').html(), 15, 15, {
    10. 'width': 600,
    11. 'elementHandlers': specialElementHandlers
    12. });
    13. documentPDF.save('Case Id - ' + caseid + '.pdf');
    14. }
  1. Click the button for the result.
  1. Here is the PDF, which gets downloaded.

    PDF
  1. Here is the PDF document when opened.
    PDF