I am trying to set the 'Default' printer in InfoPath using VB.NET.
I am NOT trying to set the Windows default printer, and I cannot instantiate a new PrintDocument() class. I want to mimic the change that happens when I click "Flie -> Print", Select another printer, then click close.
Essentially, I have a form that needs to be printed as a PDF, but the only available Writer is CutePDF. I CANNOT set CutePDF as the default Windows printer, so it needs to be selected at runtime. I have tried to instantiate a new PrintDocument() class, but CutePDF does not encode correctly when printing from code (you have to purchase the SDK).
My current problem is that the Windows default printer is a label maker with a paper size of 2.5" x 3.5". This printer CANNOT be changed due to requirements of other software. When I use "CurrentView.Export" I get a PDF but everything is blown up due to it printing an 8.5" x 11" document on such a small paper.
I need to somehow modify the currently selected printer in InfoPath, that way the "CurrentView.Export" function will use a printer with the correct page size.
Hope that takes care of the details!
Chris