1

I'm using the code posted in this answer - https://stackoverflow.com/a/45138072/5359882

The code works perfectly for the printers with 3 duplex settings (off, short edge, long edge), when trying to set duplex for the printer with 4 settings (off, open to top, open to left, booklet), setting the duplex back to simplex (off) with this line is impossible: - ds.SetPrinterDuplex(printername, 1, out errorMessage);

Setting duplex values also behaves funny... Is this resolvable? Many thanks in advance.

UPDATE For testing purposes, I've created a simple WinForm with three buttons, button1 sets the duplex to 2 ("Open to Left" on the mentioned printer) ds.SetPrinterDuplex("Gestetner DSm415 PCL 6", 2, out errorMessage); button2 is supposed to turn the duplex off ds.SetPrinterDuplex("Gestetner DSm415 PCL 6", 1, out errorMessage); button3 outputs the current duplex value to a label.

By funny behaviour, I mean: 1. Setting duplex to 2 (Open to Left) or to 3 (Open to Top) via WinForm only works, when the initial duplex setting is "Off" (which has to be switched manually beforehand). Changing the value programmatically from any other setting other than Off is not possible. 2. When input any value as duplex setting and then output with the use of the 3rd button, this value will be displayed as the current duplex value (for example, if to set 10 by ds.SetPrinterDuplex("Gestetner DSm415 PCL 6", 10, out errorMessage); (which is absurd) and the call method GetPrinterDuplex, it shows duplex value as 10. 3. "errorMessage" parameter is an empty string when duplex is set to 1.

H H
  • 263,252
  • 30
  • 330
  • 514
  • It's a good idea to list all error messages and describe the exact expected vs actual behavior. "behaves funny" is not useful. Also, the wider context of how&when you make those calls could be relevant. – H H Sep 11 '17 at 12:51
  • @Henk Holterman Updated the topic with more detailed description. Could you please have a look. I do expect that duplex value is set to "Off" when I use `ds.SetPrinterDuplex("Gestetner DSm415 PCL 6", 1, out errorMessage);` – Alla Sysoeva Sep 11 '17 at 13:17
  • I don't know enough about printers to help you any further. That the 10 is preserved isn't so strange, lots of printer types around. It may mean something to another printer. – H H Sep 12 '17 at 08:22
  • Can you get back to the Off state ? What dis you mean by "manually" ? – H H Sep 12 '17 at 08:22
  • @Henk Holterman No I can't get back to Off state programmatically, only manually. Manually means setting Duplex to Off via Control Panel - Devices and Printers for the required printer (right click -> Print Settings -> Duplex section -> selecting "Off") – Alla Sysoeva Sep 12 '17 at 11:52

1 Answers1

0

The code referenced in the first line of this thread stopped working for us when we went from a Konica Minolta 754 to a KM 958. This was fixed by switching the driver from a PCL6 driver to a post script driver for that newer model. We can now control 1-sided / 2-sided w the c# code referenced above w no paper tray error as well.

jmk
  • 1
  • 2