Printing a PDF-File from a Windows Service

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top