title: javascript to generate pdf from html string
body: <p><strong>I have an generated a html page as a string which is stored in a variable (let's call it var htmlPage)
  I want to convert it to a pdf which I can later download</strong></p>
  
  <pre><code>var htmlPage = '&lt;!DOCTYPE html&gt;\n'+
  '&lt;html lang="en" dir="ltr"&gt;\n'+
    '&lt;head&gt;\n'+
      '&lt;meta charset="utf-8"&gt;\n'+
      '&lt;title&gt;&lt;/title&gt;\n'+
  
      '&lt;style&gt;\n'+
      '.hyperlink{\n'+
        'color: blue;\n'+
        'cursor: pointer;\n'+
      '}\n'+
     '&lt;/style&gt;\n'+
    '&lt;/head&gt;\n'+
    '&lt;body&gt;\n'+
      '&lt;h1&gt;Hello world!&lt;/h1&gt;\n'+
    '&lt;/body&gt;\n'+
  '&lt;/html&gt;';
  </code></pre>