2

I have been able to find some preferences in ChromeOptions for printing, e.g. (in kotlin btw)

    val options = ChromeOptions()
            options.addArguments(
                    "--window-size=1920,1200",
                    "--kiosk-printing"
            )
    val settings = "{\"recentDestinations\": [{\"id\": \"Save as PDF\", \"origin\": \"local\", \"account\": \"\"}], \"selectedDestinationId\": \"Save as PDF\", \"version\": 2, \"isHeaderFooterEnabled\": false}"
    
    val prefs = hashMapOf(
                    "savefile.default_directory" to path,
                    "printing.print_preview_sticky_settings.appState" to settings
    )
    options.setExperimentalOption("prefs", prefs)

But is there a full list of options under "appState" for example? or inside of "recentDestinations" or even "printing" I can reference?

The best I have been able to find are https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc and https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_switches.cc but they don't tell me what the acceptable arguments are.

bebe
  • 33
  • 4

1 Answers1

1

I think I vaguely found it:

You can set landscape, scale and other printer properties using the SerializedSettings: https://github.com/chromium/chromium/blob/eadef3f685cd9e96e94fcb9645b6838b6d0907a8/chrome/browser/resources/print_preview/data/model.js

For specific printer specs, you can set RecentDestinations: https://github.com/chromium/chromium/blob/eadef3f685cd9e96e94fcb9645b6838b6d0907a8/chrome/browser/resources/print_preview/data/destination.js

bebe
  • 33
  • 4