I use Selenium WebDriver
to print pages to PDF with Robot
class. There are multiple PDF printers installed. I try to set default directory with code:
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("download.default_directory", mydownloadDirectory);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
WebDriver driver = new ChromeDriver(options);
To set built-in PDF printer as default could be set by this code, but I don't want to disable all the extension.
options.addArguments("--disable-extensions");