none
Printing PDF File from VB.net RRS feed

  • Question

  • Hi ,
      My intesion is to Print PDF File to Remote Printer from VB.net with out showing any window, i used Following code, But i but one Adobe Reader (Blank) is Showing ..
     For i = 0 To FileList.Count - 1
                    Dim startInfo As New ProcessStartInfo
                    startInfo.FileName = FileList(i).ToString
                    'startInfo.WindowStyle = ProcessWindowStyle.Hidden
                    startInfo.Verb = "print"
                    startInfo.Arguments = ""
                    startInfo.UseShellExecute = True
                    startInfo.CreateNoWindow = False
                    Dim report As Process = New Process
                    report.StartInfo = startInfo
                    report.Start()
                Next
     the problem is How to set printer and Remove Blank Adobe reader window
    Monday, June 15, 2009 1:11 PM

Answers


  •       i already checked that Property with TRUE . but Still same Problem

    i tried with Command Line Like
    Dim Process1 As New Process
                    Dim psi As New ProcessStartInfo("AcroRd32.exe", "/t " + FileList(i).ToString + " " + PrinterName + "")
                    psi.CreateNoWindow = true
                    Process1.Start(psi)
    Here remote Printer is accepting ,but Blank Abobe window is Still Comming .
    Behaviour is as expected, a blank acrobat in system tray, you cant avoid that, only thing you can do I think is close once printing finishes

                    Dim Process1 As New Process
                    Dim psi As New ProcessStartInfo("AcroRd32.exe", "/t " + FileList(i).ToString + " " + PrinterName + "")
                    Process1.StartInfo = psi
                    Process1.Start()
                                Process1.WaitForInputIdle()
                                Process1.CloseMainWindow()


    Arjun Paudel
    Monday, June 15, 2009 2:30 PM

All replies

  • Set the following property to true if you dont want any window shown

    startInfo.CreateNoWindow = True

    If this post is useful, mark it as answer.
    Monday, June 15, 2009 1:22 PM
  • Also, using the above syntax, the print would goto default printer. If you want, you could use WMI to set the default printer prior to printing.



    If this post is useful, mark it as answer.
    Monday, June 15, 2009 1:23 PM

  •       i already checked that Property with TRUE . but Still same Problem

    i tried with Command Line Like
    Dim Process1 As New Process
                    Dim psi As New ProcessStartInfo("AcroRd32.exe", "/t " + FileList(i).ToString + " " + PrinterName + "")
                    psi.CreateNoWindow = true
                    Process1.Start(psi)
    Here remote Printer is accepting ,but Blank Abobe window is Still Comming .
    Monday, June 15, 2009 1:27 PM

  •       i already checked that Property with TRUE . but Still same Problem

    i tried with Command Line Like
    Dim Process1 As New Process
                    Dim psi As New ProcessStartInfo("AcroRd32.exe", "/t " + FileList(i).ToString + " " + PrinterName + "")
                    psi.CreateNoWindow = true
                    Process1.Start(psi)
    Here remote Printer is accepting ,but Blank Abobe window is Still Comming .
    Behaviour is as expected, a blank acrobat in system tray, you cant avoid that, only thing you can do I think is close once printing finishes

                    Dim Process1 As New Process
                    Dim psi As New ProcessStartInfo("AcroRd32.exe", "/t " + FileList(i).ToString + " " + PrinterName + "")
                    Process1.StartInfo = psi
                    Process1.Start()
                                Process1.WaitForInputIdle()
                                Process1.CloseMainWindow()


    Arjun Paudel
    Monday, June 15, 2009 2:30 PM