我已经能够在ChromeOptions中找到一些打印的首选项,例如(在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)
例如,在"appState“下面有完整的选项列表吗?或者在"recentDestinations“甚至”打印“中我可以引用?
我所能找到的最好的是https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc和https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_switches.cc,但是他们没有告诉我什么是可接受的参数。
发布于 2020-10-09 03:11:41
我想我隐约找到了:
您可以使用SerializedSettings:https://github.com/chromium/chromium/blob/eadef3f685cd9e96e94fcb9645b6838b6d0907a8/chrome/browser/resources/print_preview/data/model.js设置横向、缩放和其他打印机属性
对于特定的打印机规格,您可以设置RecentDestinations:https://github.com/chromium/chromium/blob/eadef3f685cd9e96e94fcb9645b6838b6d0907a8/chrome/browser/resources/print_preview/data/destination.js
https://stackoverflow.com/questions/64235425
复制相似问题