The problem with the originally published code is that options are assigned twice, so the first value assigned, ShowsPaperSize , is overwritten by the value of ShowsOrientation . Therefore, in the dialog you see the ShowsOrientation option ShowsOrientation .
Using multiple insert operations, you add options each time, not overwrite. You can also do it like this:
operation.printPanel.options.insert([.showsPaperSize, .showsOrientation])
Finally, it also works to “set” parameters, and by providing existing parameters as the first value of the array, you get the effect of adding:
operation.printPanel.options = [ operation.printPanel.options, .showsPaperSize, .showsOrientation ]
(The first element of the operation.printPanel.options array means that the old parameters are indicated in the list of new parameters.)
source share