title: How can I create a PDF file without using a library?
body: <p>I am trying to create a PDF from a JS object without using a library, my code is as follows:</p>
  
  <pre><code>var downloadLink = document.createElement('a');
  var blob = new Blob(["Random text"], {type: 'application/pdf'})
  console.log(blob)
  var url = URL.createObjectURL(blob);
  downloadLink.href = url;
  downloadLink.download = `${title}.pdf`;
  
  document.body.appendChild(downloadLink);
  downloadLink.click();
  document.body.removeChild(downloadLink);
  </code></pre>
  
  <p>This actually creates a PDF object that gets downloaded, but the problem with this PDF is that it is unable to be opened by any pdf reader, which makes me feel like I am doing it the wrong way. My other alternative was to use <code>window.print</code> but it entails the user having to click the save button when the print dialog pops up. Any Idea on how I can solve this?</p>