0

我已经能够在 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.cchttps://chromium.googlesource.com/chromium/src/+ /master/chrome/common/chrome_switches.cc 但他们没有告诉我可接受的参数是什么。

4

1 回答 1

0

我想我隐约找到了它:

您可以使用 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

于 2020-10-08T19:11:40.817 回答