Home All Groups Group Topic Archive Search About

Bug Net 1.1 - PrintiDialog PageSize bug when select new printer?

Author
28 Aug 2006 4:22 PM
Ed Sutton
The PrintDialog works correctly in NET 2.0.  I am seeking a NET 1.1
programmatic work around to fix page size initialization.

Bug Description
---------------
PageSize is not output properly when the PrintDialog or PageSetup dialog
is used to select a non-default printer.  Instead of letter size, the
page size is 3.35" x 4.33".  This bug only occurs when you print to a
non-default printer.  Note that I am *not* using metric settings.  I am
aware of the documented 1.1 bug when using metric margins.


Steps to Reproduce in NET 1.1
-----------------------------

1 - Show PrintDialog (see code below)
2 - Select a non-default printer from the drop down.  I used Adobe PDF
in my testing with a default page size of letter (8.5" x 11")
3 - Press OK to print
3 - Verify that when page output is generated the page size is 3.35" x
4.33".  It should be letter sized.


I can manually get it to work in NET 1.1 using the following procedure.
      However, what I need is a programmatic work around.

Manual Work Around in NET 1.1
-----------------------------

1 - Show PrintDialog
2 - Select a non-default printer from the drop down.  I used Adobe PDF
in my testing with a default page size of letter (8.5" x 11")
3 - Press printer Properties button and verify the page size is letter
4 - Re-select Letter page size from the drop-down list
5 - Press OK twice to print
6 - Verify that when page output is generated it is letter sized

Sample Code
-----------

StreamReader streamToPrint = new StreamReader ("PrintMe.Txt");
TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint);
if (storedPageSettings != null)
{
    pd.DefaultPageSettings = storedPageSettings ;
}
PrintDialog dlg = new PrintDialog() ;
dlg.Document = pd;
DialogResult result = dlg.ShowDialog();
if (result == DialogResult.OK)
{
    pd.Print();
}


Thanks in advance for any tips or suggestions,

-Ed

AddThis Social Bookmark Button