title: Generate PDF with selenium chrome driver
body: <p>To generate PDF from a HTML file, I want to use selenium Chrome driver.</p>
  
  <p>I tried it with command line :</p>
  
  <pre><code>chrome.exe --headless --disable-gpu --print-to-pdf   file:///C:invoiceTemplate2.html
  </code></pre>
  
  <p>and it works perfectly, So I wanted to do that with JAVA and here's my code :</p>
  
  <pre><code>System.setProperty("webdriver.chrome.driver", "C:/work/chromedriver.exe");
  ChromeOptions options = new ChromeOptions();
  options.addArguments("--headless", "--disable-gpu", "--print-to-pdf",
              "file:///C:/invoiceTemplate2.html");
  WebDriver driver = new ChromeDriver(options);
  driver.quit();
  </code></pre>
  
  <p>The server is started with no problem, but chrome is opened with multiple tabs with the arguments I specified in Options.</p>
  
  <p>Any solution to this ? thx.</p>