Link to home
Start Free TrialLog in
Avatar of ross13
ross13Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Send a .pdf file to a specific printer

Hi,

I am writing an application in vb.net and need to send a pdf file to a specific printer.

I have been trying the following but it sends the pdf to my default printer?

    Public Function printFile(strFile As String, strPrinterName As String)


        Dim psi As New ProcessStartInfo

        Try
            psi.UseShellExecute = True
            psi.Verb = "print"
            psi.WindowStyle = ProcessWindowStyle.Hidden
            psi.Arguments = strPrinterName
            psi.FileName = strFile
            Process.Start(psi)

            Return "OK"
        Catch ex As Exception
            Return ex.Message
        Finally
            psi = Nothing
        End Try
    End Function

Regards,

Ross
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ross13

ASKER

I can run multiple applications on the same PC without having to swap the default printer. Running multiple applications this was could possibly create a problem.  The solution I used for my project is to use third party software.