Hi José,
I was attempting to set some properties for the default printer but the settings would never update.
I debugged the problem to the SetPrinterInfo method and the "pd.DesiredAccess = PRINTER_ALL_ACCESS" line. It appears that maybe that level of security access is too strict as it keep throwing an Error 5 (ERROR_ACCESS_DENIED) for me.
I changed the value to PRINTER_ACCESS_USE (the same as passing NULL to OpenPrinter) and then the code worked perfectly and I was able to set settings like Orientation.
If you do not have a need for PRINTER_ALL_ACCESS that I don't know about, then maybe using PRINTER_ACCESS_USE would be sufficient?
Thanks,
Paul
Whatever works is fine with me. I don't even have a printer :) I had one, but it is broken.
Thanks José, I see that you have committed the change to GitHub. Appreciate it. I am testing using a PDF printer until my code is mostly complete and then I will switch to some tests using my small Samsung laser printer (that mostly collects dust these days).