Results 1 to 4 of 4

Thread: Printing pdf documents from vb 2010

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    4

    Printing pdf documents from vb 2010

    I'm looking for a better way to print pdf documents from a vb 2010 app. I have tried 2 techniques that work, but both have some minor issues that I'd like to address. The 1st technique uses command line arguments as follows:

    Code:
    Dim starterStr As String = "/h /t " & Chr(34) & pdfFileName & Chr(34) & " " & Chr(34) & printerName & Chr(34)
    Dim starter As New ProcessStartInfo("AcroRd32.exe", starterStr)
    Dim print As New Process()
    With print
        .StartInfo = starter
        .Start()
        .Close()
    End With

    But this approach leaves the Acrobat process still running after completion, so users need to manually close the window.

    A 2nd technique that also works is one that sets the Process StartInfo arguments:

    Code:
    Dim print As New Process()
    With print
        .StartInfo.CreateNoWindow = True
        .StartInfo.Verb = "print"
        .StartInfo.FileName = pdfFileName
        .Start()
        .Close()
    End With
    The 2nd technique is more aesthetically pleasing to me, but has the same annoying problem of leaving the Acrobat process running after execution. It also doesn't allow me to set the output printer destination (the above code sends the output to the default printer).

    Any suggestions on:
    1. how to close the Acrobat process
    2. how to set an output printer destination using StartInfo arguments
    3. a better technique that I haven't thought of
    Last edited by dru37; Jan 26th, 2012 at 12:20 PM.

Tags for this Thread

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