title: How to use the browser's (chrome/firefox) HTML/CSS/JS rendering engine to produce PDF?
body: <p>There are nice projects that generate pdf from html/css/js files</p>
  
  <ol>
  <li><a href="http://wkhtmltopdf.org/" rel="noreferrer">http://wkhtmltopdf.org/</a> (open source)</li>
  <li><a href="https://code.google.com/p/flying-saucer/" rel="noreferrer">https://code.google.com/p/flying-saucer/</a> (open source)</li>
  <li><a href="http://cssbox.sourceforge.net/" rel="noreferrer">http://cssbox.sourceforge.net/</a> (not necessarily straight pdf generation)</li>
  <li><a href="http://phantomjs.org/" rel="noreferrer">http://phantomjs.org/</a> (open source allows for pdf output)</li>
  <li><a href="http://www.princexml.com/" rel="noreferrer">http://www.princexml.com/</a> (comercial but hands down the best one out there)</li>
  <li><a href="https://thepdfapi.com/" rel="noreferrer">https://thepdfapi.com/</a> a chrome modification to spit pdf from html from </li>
  </ol>
  
  <p>I want to programatically control chrome or firefox browser (because they both are cross platform) to make them load a web page, run the scripts and style the page and generate a pdf file for printing. </p>
  
  <p>But how do I start by controlling the browser in an automated way so that I can do something like</p>
  
  <p>render-to-pdf file-to-render.html out.pdf</p>
  
  <p>I can easily make this job manually by browsing the page and then printing it to pdf and I get an accurate, 100% spec compliant rendered html/css/js page on a pdf file. Even the url headers can be omitted in the pdf through configuration options in the browser. But again, how do I start in trying to automate this process?</p>
  
  <p>I want to automate in the server side, the opening of the browser, navigating to a page, and generating the pdf using the browser rendered page.</p>
  
  <p>I have done a lot of research I just don't know how to make the right question. I want to programatically control the browser, maybe like selenium does but to the point where I export a webpage as PDF (hence using the rendering capabilities of the browser to produce good pdfs)</p>