e.PageSettings.Landscape = True and PrinterDocument1.DefaultPageSettings.Landscape = True didn't work for me.
How to automatically define the orientation to landscape?
Thanks.
e.PageSettings.Landscape = True and PrinterDocument1.DefaultPageSettings.Landscape = True didn't work for me.
How to automatically define the orientation to landscape?
Thanks.
I thought for sure I posted a reply to this yesterday. Anyhow, don't set printer orientation in the PrintPage event (which is what you seem to be doing), set it before the PrintDocument.Print event is called:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemDrawingPrintingPageSettingsClassLandscapeTopic.htm
VB Code:
Public Sub Printing() Try streamToPrint = New StreamReader(filePath) Try printFont = New Font("Arial", 10) Dim pd As New PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage pd.PrinterSettings.PrinterName = printer ' Set the page orientation to landscape. [b] pd.DefaultPageSettings.Landscape = True pd.Print()[/b] Finally streamToPrint.Close() End Try Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
This tested OK for me.
Oh, you are right!
Thanks! :D
cheers mate