Hello
I am trying to print a PDF file to default printer without user seing this. I am using vb.net
This is the code I have tried and it will open the pdf file if you put open instead of print BUT if you put print it says.
I have also used the following code with the same error
Does anyone know how to print a PDF using VB
I am trying to print a PDF file to default printer without user seing this. I am using vb.net
This is the code I have tried and it will open the pdf file if you put open instead of print BUT if you put print it says.
"System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at TransUnion.TransUnion.MainRun()
"
VB.NET:
'Dim MyProcess As New Process
'MyProcess.StartInfo.FileName = "C:\TransUnionReports\Credit\" + indexnm(x) + "-" + first(x) + "-" + last(x) + "-CreditReport.pdf"
'MyProcess.StartInfo.Verb = "Open"
'MyProcess.StartInfo.Verb = "Print"
'MyProcess.Start()
VB.NET:
Dim psi As New ProcessStartInfo
psi.UseShellExecute = True
psi.Verb = "print"
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.FileName = "C:\TransUnionReports\Credit\" + indexnm(x) + "-" + first(x) + "-" + last(x) + "-CreditReport.pdf"
Process.Start(psi)