Printing a PDF-File from a Windows Service

  • Thread starter Thread starter Gernot Pfeifer
  • Start date Start date
G

Gernot Pfeifer

Hello world,

I wrote a Service (in VB.Net 2005), which should print a PDF-File to a
specific printer.

As an application everything works fine, but as a developed the service it
didn't work anymore. It seems, that the Process "AcroRd32.exe" didn't start
at all.

BTW:
The service is running as "LocalSystem".
Here ist my SourceCode:
*************************************************************************************
Dim pathToExecutable As String = "AcroRd32.exe" ' I also tried the
full-path.
Dim sReport = "c:\example.pdf"

Dim SPrinter = "Brother XXXX"

Dim starter As New ProcessStartInfo(pathToExecutable, "/t """ +
sReport + """ """ + SPrinter + """")

Dim Process As New Process()

Process.StartInfo = starter

Process.Start()

Process.WaitForExit(10000)

Process.Kill()

Process.Close()
*************************************************************************************

Many thanks....

Gernot
 
Back
Top