* "=?Utf-8?B?Y3BvcGhhbQ==?=" <an*******@discussions.microsoft.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(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.
pd.DefaultPageSettings.Landscape = True
pd.Print()
Finally
streamToPrint.Close()
End Try
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>