title: HTML5 download website as PDF
body: <p>I've read <a href="http://webreflection.blogspot.de/2011/08/html5-how-to-create-downloads-on-fly.html" rel="nofollow">here</a> that every html website can be saved as PDF. </p>
  
  <p>This is exactly what a i need. 
  I need to create a "Download to PDF" button that saves the current website to PDF. </p>
  
  <p>Watching the code in that website understand that to save the website as pdf i need to construct every element in the website using javascript? </p>
  
  <p>Can't i simply point to "/ticket.html" as save it as a PDF?</p>
  
  <pre><code>function createPDFLink(fileName) {
      var doc = new pdf();
      // whatever content you want to download
      var a = document.createElement("a");
      a.download = fileName;
      a.title = "download as PDF";
      a.href = doc.output('datauri',{"fileName":name});
      return a;
  }
  
  // some paragraph in the page
  document.querySelector(
      "p.saveaspdf"
  ).appendChild(createPDFLink(
      "document-" + document.title + ".pdf"
  ));
  </code></pre>