Ticket #14154 (closed defect: invalid)
Printing fails when selecting a printer device whose (descriptive) name is longer than 32 characters (common for network printers)
|Reported by:||mmacleod||Owned by:|
|Keywords:||print printing network||Cc:|
When trying to print on wxMSW printing seems to fail when selecting printers that have long names in the printing dialog. I first noticed this on a network printer as these tend to have long names but can also replicate this just by giving a normal printer a long name.
I have traced this down to the fact that wxPrintNativeData::InitializeDevMode(...) uses the DocumentProperties(...) function ( http://msdn.microsoft.com/en-us/library/windows/desktop/dd183576%28v=vs.85%29.aspx) to fill in a DEVMODE ( http://msdn.microsoft.com/en-us/library/windows/desktop/dd183565%28v=vs.85%29.aspx) structure, however the DEVMODE structure truncates device names to 32 characters.
Later on the code passes the name to CreateDC(...) inside wxGetPrinterDC(...) however CreateDC(...) expects the full printer device name and therefore fails.
It appears that the printer name would have to be obtained by some other means in order to avoid truncation, although it is not clear to me how. It looks like GetPrinter(...) and PRINTER_INFO_4 might be capable of doing this but I don't know if it is; or if there is perhaps some better way?