title: How to render a html string content in PDF using JsPDF in ReactJS
body: <p>I need to show a PDF with the HTML string available. I am using JsPDF for this. I used to get a dynamic content as string. The received string will be a html content. This needs to be formatted and show in a PDF. </p>
  
  <p>I used the below command to install JsPDF</p>
  
  <pre><code>npm i jspdf --save
  </code></pre>
  
  <p>And I initialised the library and provided the content. Calling save downloads the file.</p>
  
  <pre><code>var doc = new jsPDF()
  doc.text('&lt;html&gt;&lt;/head&gt; Title &lt;/head&gt;&lt;body&gt; Content &lt;/body&gt;&lt;/html&gt;', 10, 10)
  doc.save('a4.pdf') 
  </code></pre>
  
  <p>This prints the text as it is. I need to show that as formatted html. Also it is good it it opens in new tab rather than downloading.</p>
  
  <p>Thanks.</p>