title: How to convert an HTML file to PDF using wkhtmlpdf in Java
body: <p>I want to convert an HTML file into a PDF file using <code>wkhtmltopdf</code>. <code>wkhtmltopdf</code> is the best option for me as it renders the HTML file using <em>WebKit</em>. The problem is that I want to do the same using Java but <code>wkhtmltopdf</code> does not provide any Java API. </p>
  
  <p>I can use <code>Runtime.exec()</code> or <code>ProcessBuilder</code> to fork a new process from Java and create the PDF output using <code>wkhtmtopdf</code> in that process. But, as I am developing a web based application, I am not allowed to create so many new processes in the server. </p>
  
  <p>Is there any other way so that I can use <code>wkhtmltopdf</code>? I really want to use it as it's giving me the exact output.</p>
  
  <p>Or, is there any other open source browser engine that provides a Java API that can render my HTML page just like <code>wkhtmltopdf</code>? </p>