* "=?Utf-8?B?Y3BvcGhhbQ= =?=" <an*******@disc ussions.microso ft.com> scripsit:
I have a simple program to print a text file. I need to know how to
change the page settings to landscape if it is not already in ladnscape
mode. I do not want to use a dialog to do it and this appears the only
way you can do it. I just need it to spit out the print in landscape
orientation. Why is this so hard to do for something that should be
easy.
Sample taken from MSDN documentation:
\\\
Public Sub Printing()
Try
streamToPrint = New StreamReader(fi lePath)
Try
printFont = New Font("Arial", 10)
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf pd_PrintPage
pd.PrinterSetti ngs.PrinterName = printer
' Set the page orientation to landscape.
pd.DefaultPageS ettings.Landsca pe = True
pd.Print()
Finally
streamToPrint.C lose()
End Try
Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
End Sub
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>