Microsoft KB Archive/945411

= UserPrintTicket property inconsistent on local print server =

Article ID: 945411

Article Last Modified on 11/20/2007

-

APPLIES TO


 * Microsoft .NET Framework 3.0

-



Source: Microsoft Support



RAPID PUBLISHING
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.



Action
You develop a Windows Presentation Foundation (WPF) application and you call the PrintServer.GetPrintQueues method. You add code to examine the properties in the UserPrintTicket object returned for local printers.



Result
When examining the properties in the UserPrintTicket object, you find that the printer settings the user made in the Control Panel Printers applet are not reflected in those properties.



Cause
|Microsoft has confirmed that this is a |bug in the |Microsoft products that are listed at the beginning of this article.



Resolution
The recommendation is that you call PrintQueue.Refresh as follows for the workaround:

{

foreach (PrintQueue _printQueue in new LocalPrintServer.GetPrintQueues)

{

_printQueue.Refresh;

MessageBox.Show(_printQueue.UserPrintTicket.PageOrientation.ToString);

}

}



MoreInformation
To reproduce the issue, change the printer orientation to Landscape, for example, in the Control Panel Printers applet for one of your local printers. You will notice that the following code will report that Portrait is set, even though you have specified Landscape:

void OnClick1(object sender, RoutedEventArgs e)

{

foreach (PrintQueue _printQueue in new LocalPrintServer.GetPrintQueues)

{

MessageBox.Show(_printQueue.UserPrintTicket.PageOrientation.ToString);

}

}

The recommendation is that you call PrintQueue.Refresh as follows for the workaround:

{

foreach (PrintQueue _printQueue in new LocalPrintServer.GetPrintQueues)

{

_printQueue.Refresh;

MessageBox.Show(_printQueue.UserPrintTicket.PageOrientation.ToString);

}

}



DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Keywords: kbnomt kbrapidpub KB945411

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.