This sounds like an initialization problem on certain printers. Here's the use-case:
// Get the default printer.
PrintQueue printer = LocalPrintServer.GetDefaultPrintQueue();
// Get the printer properties as XML from the system and populate the instance of PrinterProperties.
Stream printerDocmentStream = printer.GetPrintCapabilitiesAsXml();
From the XML document retrieved, the XML element PageMediaSize does not hold comprehensive list of supported page sizes for certain class of printers.
However, when XML document is retrieved after a call to the DefaultPrintTicket, the XML element PageMediaSize returns all the supported page sizes. The code is as follows:
// This call initializes the printer properties. <--------------------
PrintTicket dummyPrintTicket = printer.DefaultPrintTicket; <-----------
// Get the default printer.
PrintQueue printer = LocalPrintServer.GetDefaultPrintQueue();
// Get the printer properties as XML from the system and populate the instance of PrinterProperties.
Stream printerDocmentStream = printer.GetPrintCapabilitiesAsXml();
I am guessing that a call to DefaultPrintTicket initializes the instance of PrintQueue, there is an initialized method but it is protected.
Is this bug ? Is anyone seeing a similar behavior ?
P.S: The printer I am using is: HP Designjet T7100ps HPGL2