Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ASP.net printing

0 views
Skip to first unread message

Tony WONG

unread,
Dec 25, 2009, 12:44:20 AM12/25/09
to
so far i have designed some pages for data input, such leave application,
acquistion request.

now i wish to have print copies for signature.

is it possible that when a user enter a record, then
1. there will be print copies from the network printer
2. a copy from tray 1, another copy from tray 2 of printer.
3. prefer not to print by word, not require Server logon
4. light-weighted design & stable

grateful for any ideas & samples

thanks a lot.

tony


Mark Rae [MVP]

unread,
Dec 25, 2009, 12:21:06 PM12/25/09
to
"Tony WONG" <x...@netvigator.com> wrote in message
news:eCtEIVSh...@TK2MSFTNGP02.phx.gbl...

> So far I have designed some pages for data input, such as leave
> application, acquistion request.
>
> Now I wish to print copies for signature.
>
> Is it possible that when a user enter a record, then


> 1. there will be print copies from the network printer
> 2. a copy from tray 1, another copy from tray 2 of printer.

> 3. prefer not to print by Word, not require Server logon


> 4. light-weighted design & stable
>

> Grateful for any ideas & samples

Firstly, I would advise you to forget completely any ideas of trying to
persuade ASP.NET to do the printing directly. It's really not designed for
that at all.

You mention a network printer, so I'm assuming that this web application is
designed to run on an internal intranet rather than the public Intranet.

If I were designing this, I'd almost certainly write a Windows service to
handle the actual printing process. When the users enter a record, the
Windows service takes over. The easiest way is to use a timer in the Windows
service to query the database at regular intervals for new records to be
printed.

You mention not wanting to use Word - that's good, as server-side Office
automation isn't supported. Instead, I'd use this:
http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx.
It will allow you to create a Word document without Word itself, and
supports your fine-tuning printing requirements including specifying paper
trays, etc...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Gregory A. Beamer

unread,
Dec 28, 2009, 10:58:35 AM12/28/09
to
"Tony WONG" <x...@netvigator.com> wrote in
news:eCtEIVSh...@TK2MSFTNGP02.phx.gbl:

> so far i have designed some pages for data input, such leave
> application, acquistion request.
>
> now i wish to have print copies for signature.
>
> is it possible that when a user enter a record, then
> 1. there will be print copies from the network printer
> 2. a copy from tray 1, another copy from tray 2 of printer.
> 3. prefer not to print by word, not require Server logon
> 4. light-weighted design & stable

I will likely reiterate a lot of what Mark has stated.

Printing can be initiated from ASP.NET. After user input, you can create
a printable page and then prompt the user to print it. This is done by
emiting some JavaScript. Note, however, that the user can cancel. This
is the best option, in most cases, for Internet apps or very large
networks.

Since you mention a network printer, you do have the option of backend
printing to a network printer. But, this can be tricky, as you have to
have all of the printer drivers on the network on the server that prints
and you have to know which printer the user is going to print to (map
users to printers in a data store?). If you have a very small network,
then this is not a huge deal to maintain, but on large networks, this
can be a bear.

You should always allow the user to save the document, just in case, the
print fails. Unfortunately, many of the print options out there do not
give much feedback when the print fails (fire and forget), so this
option is nice to have. And having a repository with documents so the
user can retrieve one is a nice alternative.

Make sure you handle any print errors so you can inform the user that
he/she needs to save the document and print it.

I saw this one recently:
http://snurl.com/tw085

It uses Dynamic Data Exchange (DDE). It is just one example. Automating
printing is also possible through many third party components, many of
which are far cheaper than your time to purchase.

PDF is nice for documents, as there are plenty of open source PDF
libraries out there and it is quite easy to send to printers (at least
these days it is, go back to the 90s when there were far more PCL
printers and it was a pain).

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************

Mark Rae [MVP]

unread,
Dec 28, 2009, 11:13:54 AM12/28/09
to
"Gregory A. Beamer" <NoSpamM...@comcast.netNoSpamM> wrote in message
news:Xns9CEF6534...@207.46.248.16...

> Automating printing is also possible through many third party components,
> many of which are far cheaper than your time to purchase.

Indeed, though I've never seen one which can be used to specify individual
paper trays, etc...

I guess I've never needed to use anything other than Aspose...

Gregory A. Beamer

unread,
Dec 28, 2009, 2:17:11 PM12/28/09
to
"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in
news:#FdDAj9h...@TK2MSFTNGP02.phx.gbl:

> Indeed, though I've never seen one which can be used to specify
> individual paper trays, etc...

I am not sure about the individual trays. There has to be some way to
profile it or something, but you can at least print.



> I guess I've never needed to use anything other than Aspose...

I am not as fond of web apps that auto print, or auto initiate any
peripheral for that matter. I understand the motivation, but it is a train
wreck waiting to happen in many instances.

Mark Rae [MVP]

unread,
Dec 28, 2009, 3:39:15 PM12/28/09
to
"Gregory A. Beamer" <NoSpamM...@comcast.netNoSpamM> wrote in message
news:Xns9CEF86DF...@207.46.248.16...

> I am not as fond of web apps that auto print, or auto initiate any
> peripheral for that matter. I understand the motivation, but it is a train
> wreck waiting to happen in many instances.

I couldn't agree more, hence the web service...

0 new messages