Results 1 to 3 of 3

Thread: Printing in Landscape

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Printing in Landscape

    Hello Everybody,

    I am using following method to print a file programmatically. Is there a way to tell the program to print the file in landscape?

    Code:
    Public Function PrintPDF(ByVal PDFFile As String, ByVal Printer As String, ByVal Timeout As Integer) As Integer
    
            If PrinterName.Trim.Length = 0 Then
                PrinterName = (New System.Drawing.Printing.PrinterSettings).PrinterName
            End If
            'PrinterName = "a"
            Dim Proc As New System.Diagnostics.Process
    
            Proc.EnableRaisingEvents = True
            Proc.StartInfo.FileName = PDFFile
            Proc.StartInfo.Arguments = Chr(34) + PrinterName + Chr(34)
            Proc.StartInfo.Verb = "PrintTo"
            Proc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
            Proc.StartInfo.CreateNoWindow = True
            If Proc.Start() = False Then
                Exit Function
            End If
    
            'Do While Timeout > 0 AndAlso Not Proc.HasExited
            '    System.Threading.Thread.Sleep(1000)
            '    Timeout -= 1
            'Loop
    
            If Not Proc.HasExited Then
                Debug.Print("Killing process")
                Proc.Kill()
            End If
    
            Debug.WriteLine("Closing process")
            Proc.Close()
    
            Return 0
        End Function
    Thanks.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Printing in Landscape

    I don't think you can do this with command line arguments. You should be able to change the printer's default setting to landscape.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Printing in Landscape

    Is there any other way where I can specify orientation? I can get rid of the above method.

    Thanks.

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