Results 1 to 4 of 4

Thread: Print: How to automatically define the orientation to landscape? (RESOLVED)

  1. #1

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200

    Question Print: How to automatically define the orientation to landscape? (RESOLVED)

    e.PageSettings.Landscape = True and PrinterDocument1.DefaultPageSettings.Landscape = True didn't work for me.

    How to automatically define the orientation to landscape?


    Thanks.
    Last edited by AlvaroF1; Oct 23rd, 2003 at 08:51 PM.

  2. #2
    Lively Member
    Join Date
    Oct 2003
    Posts
    88
    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:
    1. Public Sub Printing()
    2.     Try
    3.         streamToPrint = New StreamReader(filePath)
    4.         Try
    5.             printFont = New Font("Arial", 10)
    6.             Dim pd As New PrintDocument()
    7.             AddHandler pd.PrintPage, AddressOf pd_PrintPage
    8.             pd.PrinterSettings.PrinterName = printer
    9.             ' Set the page orientation to landscape.
    10. [b]            pd.DefaultPageSettings.Landscape = True
    11.             pd.Print()[/b]
    12.         Finally
    13.             streamToPrint.Close()
    14.         End Try
    15.     Catch ex As Exception
    16.         MessageBox.Show(ex.Message)
    17.     End Try
    18. End Sub

    This tested OK for me.

  3. #3

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200
    Oh, you are right!

    Thanks!

  4. #4
    Lively Member
    Join Date
    Oct 2003
    Posts
    88
    cheers mate

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width