DotNetBlocks
Programmer
Hello,
Does anyone have an example of specifying the paper source and color settings when trying to print files in vb 2005?
Here is my current print function, but I need to be able to select the paper source and color settings.
Any help is much appreciated.
Babloome
Does anyone have an example of specifying the paper source and color settings when trying to print files in vb 2005?
Here is my current print function, but I need to be able to select the paper source and color settings.
Any help is much appreciated.
Babloome
Code:
Dim pathToExecutable As String = "C:\Program Files\Adobe\Acrobat 4.0\Reader\acrord32.exe"
''calling function
RunExecutable(pathToExecutable, "/t ""c:\testprint.pdf"" ""KONICA MINOLTA C252/C252P PCL""", 1)
Public Sub RunExecutable(ByVal executable As String, ByVal arguments As String, ByVal AffilateID As Integer)
Dim starter As New ProcessStartInfo(executable, arguments)
starter.CreateNoWindow = True
starter.RedirectStandardOutput = True
starter.UseShellExecute = False
Dim process As New Process()
process.StartInfo = starter
process.Start()
Dim buffer As New StringBuilder()
Using reader As StreamReader = process.StandardOutput
Dim line As String = reader.ReadLine()
While line IsNot Nothing
buffer.Append(line)
buffer.Append(Environment.NewLine)
line = reader.ReadLine()
Console.WriteLine(line)
Thread.Sleep(100)
process.CloseMainWindow()
process.Close()
End While
End Using
If process.ExitCode <> 0 Then
Throw New Exception(String.Format("""{0}"" exited with ExitCode {1}. Output: {2}", executable, process.ExitCode, buffer.ToString()))
My.Application.Log.WriteEntry(String.Format("""{0}"" exited with ExitCode {1}. Output: {2}", executable, process.ExitCode, buffer.ToString()) & " " & Now().ToString)
End If
End Sub