[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

PrintDocument from a web service - possible?

Dave Slinn

12/27/2002 5:17:00 PM

I am creating an intranet application and would like to use WebServices to
offload all printing services onto a separate server. I have created a
simple web service that uses a PrintDocument object (available from the
Windows Forms tab), and everything seems to work fine - the object gets
initialized, the PrintPage event is fired, the DrawString and DrawRectangle
functions I have added to the PrintPage handler seem to execute, and control
is returned to the calling PrintDocument1.Print method, and the web service
function returns true.

However, a couple of seconds later a Printers Folder message pops up saying
there was an error writing to the specified printer. I check the Event Log
and the following info is there:

"The document dave's test output owned by ASPNET failed to print. Win32
error code returned by the print processor: 3003 (0xbbb)."

I look up error 3003 and this is the text - "A StartDocPrinter call was not
issued. "

When I use this code in a Windows Form appication, it works fine. Why, when
the Windows Forms controls are available for use in a web service, does this
not work? Does it have something to do with the fact that when you issue
the Print method of a PrintDocument there is a window that pops up
displaying the status of the print job. Can I disable this and make the
webservice GUI-less? Is this the problem?

Any help would be appreciated.

- Dave


1 Answer

Alek Davis

12/27/2002 7:14:00 PM

0

Dave,

Are you using the default printer when you do you print job? If so, does
your ASPNET account have a default printer defined for it? You see, printers
are normally configured for login accounts, so if your ASPNET account does
not have any printers associated with it, where would the print job go
(assuming that you cannot define a printer for a print job
programmatically)? This is why when you print from a Windows Form, you must
be logged as a user which has a default printer, but when a Web service
tries to do the same, it runs as an ASPNET user, and I bet you that this
user does not have a default printer. Anyway, if this is your problem, you
may be able to fix it by setting the default printer on a system (not user)
level. See
http://groups.google.com/groups?q=%22alek+davis%22&hl=en&lr=&ie=UTF-8&...
-8&selm=%23LapwcbiCHA.3736%40tkmsftngp08&rnum=3 for additional info (watch
for line breaks).

-- Alek

"Dave Slinn" <dslinn@accesscomm.ca> wrote in message
news:ewKv#NcrCHA.2556@TK2MSFTNGP09...
> I am creating an intranet application and would like to use WebServices to
> offload all printing services onto a separate server. I have created a
> simple web service that uses a PrintDocument object (available from the
> Windows Forms tab), and everything seems to work fine - the object gets
> initialized, the PrintPage event is fired, the DrawString and
DrawRectangle
> functions I have added to the PrintPage handler seem to execute, and
control
> is returned to the calling PrintDocument1.Print method, and the web
service
> function returns true.
>
> However, a couple of seconds later a Printers Folder message pops up
saying
> there was an error writing to the specified printer. I check the Event
Log
> and the following info is there:
>
> "The document dave's test output owned by ASPNET failed to print. Win32
> error code returned by the print processor: 3003 (0xbbb)."
>
> I look up error 3003 and this is the text - "A StartDocPrinter call was
not
> issued. "
>
> When I use this code in a Windows Form appication, it works fine. Why,
when
> the Windows Forms controls are available for use in a web service, does
this
> not work? Does it have something to do with the fact that when you issue
> the Print method of a PrintDocument there is a window that pops up
> displaying the status of the print job. Can I disable this and make the
> webservice GUI-less? Is this the problem?
>
> Any help would be appreciated.
>
> - Dave
>
>