2012-08-30 4 views
0

이것은 특정 프린터의 초기화 문제와 같습니다. 여기 유스 케이스의 :PrintQueue :: GetPrintCapabilitiesAsXml()은 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(); 

검색 한 XML 문서에서, XML 요소 PageMediaSize는 프린터의 특정 클래스에 대한 지원 페이지 크기의 포괄적 인 목록을 보유하지 않습니다.

그러나 DefaultPrintTicket을 호출 한 후 XML 문서를 검색하면 XML 요소 PageMediaSize가 지원되는 모든 페이지 크기를 반환합니다. 내가 DefaultPrintTicket에 대한 호출이 인쇄 큐의 인스턴스를 초기화 추측하고

// 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(); 

,이 초기화 된 방법이지만,이 보호되어 다음과 같이 코드입니다.

이 버그입니까? 비슷한 행동을하는 사람이 있습니까?

P.S : 내가 사용하고있는 프린터는 다음과 같습니다 HP 디자인 젯 T7100ps HPGL2이 버그를 확인

답변

1

. GetPrintCapablitiesAsXml()이 PrintQueue 인스턴스에 의해 호출되는 첫 번째 메서드 인 경우 반환 된 XML은 프린터의 모든 속성을 올바르게 열거하지 않습니다.