COMException: Word cannot print.

N

NickCowley

Hello everyone

I'm having an issue with getting my ASP.NE code to print serverside to
network printers.

It works fine when it is a local printer, but, as soon as I choose a network
printer if fails on the PrintOut() with COMException: Word cannot print.
There is no printer installed.

Printer works fine and is accessiabe if running word app.

Any ideas?

code example below:

Word.ApplicationClass oWordApp = new Word.ApplicationClass();
...............
{Various bits of code to create doc, etc.}
...............
oWordApp.ActivePrinter = DefaultPrinter;

oWordApp.PrintOut(ref missing, ref missing, ref missing, ref missing, ref
missing, ref missing, ref missing,ref missing,ref missing, ref missing,ref
missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing, ref missing, ref missing);

oWordApp.Documents.Close(ref doNotSave, ref missing, ref missing);

Many thanks in advance.

Kind Regards

Nick
 
J

Jim Vierra

What account is the COM Impersonating?
Does the account have a real user profile ON the server?
Does the account have a printer set up?
Can the account print at the server from an interactive session?
Does the web site have application have permission to use the resource?

Depends on how you have the application and the web site set up.
Web site running in he Default App pool do not have access to server
resources like printers because they are running under an acount that has
no, or a limitesd, profile. If you set the application object to "Run As" a
user account I don't believe it loads the profile when it is run. That is
there is really no user looged in just the app running with the user
credentials.

Check this I think it's on the right track.
 
N

NickCowley

Hi Jim

Managed o resollve this issue by setting up the priners with new local pots
pointing to the remote server.

Howev, now have another issue - see my new post Server-side printing of Word
document to remote printer

Many thanks for the quick response.

Kind Regads

Nick
 
J

Jim Vierra

You forgot to test before you ran itt huh?

I do that to myself.

I have seen that error before. If I can remember where and why I will post
back if no one has an answer.

Try the MS KB with the error for more background.
 

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