Export To PDF In SharePoint

  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.                  
    6.             </div>  
  1. Here is the function representing linked to that button and gets executed when triggered.
    1. function exportSelectedItemsToPdf() {  
    2.   
    3.               
    4.   
    5.             var documentPDF = new jsPDF();  
    6.             var caseid = $("#caseid_lb").text();  
    7.             var specialElementHandlers = {  
    8.                 '#editor'function (element, renderer) {  
    9.                     return true;  
    10.                 }  
    11.             };  
    12.   
    13.   
    14.             documentPDF.fromHTML($('#tab-5').html(), 15, 15, {  
    15.                 'width': 600,  
    16.                 'elementHandlers': specialElementHandlers  
    17.             });  
    18.             documentPDF.save('Case Id - ' + caseid + '.pdf');   
    19.   
    20.         }  
  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
Ebook Download
View all
Learn
View all