-
January 14th, 2013, 03:50 AM
#1
Windows 2008 service Office automation cant find printer.
Hi,
I have programmed a Windows Service that open a document in Microsoft Word, and then print it to a Ghostscript PDF printer to create a PDF file.
It work perfectly on Windows 2003 server. But running it on Windows 2008 r2 it fails. (I am aware of the Desktop folders that need to be created under the system profile, and that solved another problem I had at first).
If i run the service as an application instead, everything works perfect. So it seems that everything is setup and configured correctly.
But when I run it as a Service, I get the following error in my logfile, generated from Microsoft Word:
"Error in Microsoft Word: Word cannot print. There is no printer installed."
I have added a printer and manually selected the Ghostscript driver, and also set it as a default printer. So it should work.
When I added the printer I was logged in as an administrator. And it is the same user that runs the Service (it is not the system user).
Please help me with this! It is very urgent. I have spent a couple of days now googling on it but cant find anything useful.
Kind regards
Marcus
-
January 14th, 2013, 07:36 AM
#2
Re: Windows 2008 service Office automation cant find printer.
Possibly, "Allow service to interact with desktop"?
-
January 14th, 2013, 07:41 AM
#3
Re: Windows 2008 service Office automation cant find printer.
Originally Posted by sotoasty
Possibly, "Allow service to interact with desktop"?
Thanks, but as I said the service is configured to run with a specific user, not the internal one (so this checkbox is unavaliable).
But I recently discovered in some other forums that even if the Service is run by a specific user, it apparently get the environment
from the interal user. Maybe thats why it cant locate the printer.
Do anyone know how to fix this? To make the system user able to find the printers?
-
January 15th, 2013, 02:24 AM
#4
Re: Windows 2008 service Office automation cant find printer.
Originally Posted by df03anma
Do anyone know how to fix this? To make the system user able to find the printers?
Is that printer available to the user? Can you log on under that user account and check?
-
January 15th, 2013, 02:30 AM
#5
Re: Windows 2008 service Office automation cant find printer.
Originally Posted by Arjay
Is that printer available to the user? Can you log on under that user account and check?
How do you log in as the internal user? I dont think it is possible..
-
January 15th, 2013, 03:35 AM
#6
Re: Windows 2008 service Office automation cant find printer.
I have to make a correction.
I tried this in two similar windows 2008 server environments (vmware), and I realize that in one of them I forgot to configure the service to run with the .\administrator. Instead it runs with the "local service" account, which might explain why I cant find any printer installed.
But, when I change it to administrator, i still get problem. Error 372 in the event viewer, a classic spooling problem. In advanced setup on the printer i changed the setting to print directly to the printer (without spooling), but it did not work (the error in event viewer dissapeared though).
Please help me with this one.
-
January 15th, 2013, 05:07 AM
#7
Re: Windows 2008 service Office automation cant find printer.
You wont believe this. I finally got it to work.
Everytime I ran my Service the printer job got stuck in the queue with status "spooling...". I discovered that the following code segment somehow upheld the printing job.
while (WordApp.BackgroundPrintingStatus > 0) { sleeeeeeeeep for 250 milliseconds }
Removing this solved the problem!! The printerjob never get stuck, and runs smothly.
Unbelievable..
-
January 15th, 2013, 11:08 PM
#8
Re: Windows 2008 service Office automation cant find printer.
Originally Posted by df03anma
How do you log in as the internal user? I dont think it is possible..
What do you mean by internal user? Do you mean the built-in service account?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|