I’m using SumatraPDF to automatically print PDF files to the default printer on Windows. An application of mine is setting the printer I want to use as default printer, setting its default settings for the current user to what I need regarding duplex mode, the bin to use etc. and afterwards executing the following command line to let SumatraPDF print the file:
SumatraPDF.exe -print-to-default “…”
This worked for quite some years for some HP printers and is not working anymore under certain conditions with some “Konica Minolta bizhub C658”. During printing, my duplex settings seem to be ignored. This most likely is some issue with Sumatra, the printer driver and the printer, because other PDF printing software doesn’t show the problem with the Konica Minolta and Sumatra doesn’t show that problem with the HP printers. Additionally I’m pretty sure that my settings are correct as well, because I dumped DEVMODE and that looked OK and even the printer driver settings GUI correctly showed my settings before Sumatra gets executed.
I had a look at the printing code in Sumatra and found some “settings” mentioned, which optionally contain information about duplex mode and such. Now I’m wondering where those settings are coming from and under which conditions?
The user is not changing anything using the GUI, I’m not providing any other options on the command line and therefore the settings file of Sumatra should be pretty much default. I verified that it doesn’t contain relevant print related options, only the following:
PrintScale = shrink
PrintAsImage = false
Is there any other file or registry setting or automatic detection of printer settings which might be applied in my use-case? Or are simply none used and Print::ApplyPrintSettings doesn’t do anything? How can I make sure, is there any way to debug the actual print settings used?
Im suspecting something related to printer settings or such because of how Sumatra seems to print and the following documentation about CreateDC, which Sumatra uses after it got and optionally changed printer settings of DocumentProperties:
When you call CreateDC to create the HDC for a printer device, the printer driver validates the DEVMODE. If the printer driver determines that the DEVMODE is invalid (that is, printer driver can’t convert or consume the DEVMODE), the printer driver provides a default DEVMODE to create the HDC for the printer device.
That is pretty much what I’m seeing, my own settings are ignored and some printer default settings are used.