473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Determining the Default Printer

my.computer.printers.defaultprinter doesn't exist in 2005, despite the
plethora of examples still out on the web detailing its use.

So how can I determine a person's default printer using ASP 2?

Thanks!
Nov 24 '07 #1
4 2390
"David C. Barber" <da***@NOSPAMdbarber.comwrote in message
news:zZ******************************@comcast.com. ..
my.computer.printers.defaultprinter doesn't exist in 2005, despite the
plethora of examples still out on the web detailing its use.

So how can I determine a person's default printer using ASP 2?
You can't - ASP.NET has no way of interfacing directly with the hardware on
the machine on which the client browser is running...

What use would this information be anyway...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 24 '07 #2
"David C. Barber" <da***@NOSPAMdbarber.comwrote in message
news:_Z******************************@comcast.com. ..
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OF**************@TK2MSFTNGP04.phx.gbl...
>"David C. Barber" <da***@NOSPAMdbarber.comwrote in message
news:zZ******************************@comcast.com ...
my.computer.printers.defaultprinter doesn't exist in 2005, despite the
plethora of examples still out on the web detailing its use.

So how can I determine a person's default printer using ASP 2?

You can't - ASP.NET has no way of interfacing directly with the hardware
on
>the machine on which the client browser is running...

What use would this information be anyway...?
I have a user printing out of the Crystal Reports Viewer control version
XI
R2. I need to know when they are printing, and unlike the VB6 version of
this control where you could trap the Print Event on the control itself,
there is no option for that in ASP that I've been able to determine.
Indeed not... WinForms and WebForms are *totally* different... When a
webserver (IIS or whatever) streams down a page to a client browser, it has
no further interaction with that client browser until / unless that client
browser sends it another HttpRequest - there is no permanent connection...

Controlling and querying printers is a breeze in a WinForms app because the
app is running on the local machine. This isn't the case with ASP.NET, which
runs on a webserver not the client machine.
Even if it's harder to determine the default printer for a user, it should
hardly be impossible. But I don't know what to try next in this regard,
and
was hoping for some help here.
Natively, you have no chance whatsoever of doing this... As I said, a web
application has no way of interfacing natively with the hardware on which
the client browser is running - in fact, all modern browsers are designed
specifically to prevent this, for fairly obvious security reasons...

Your only hope would be to use something like WSH, but that would only work
in IE (it's ActiveX) and would require you to seriously ramp down your
security - I can't advise you to even consider this...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 25 '07 #3
re:
!Natively, you have no chance whatsoever of doing this... As I said, a web
!application has no way of interfacing natively with the hardware on which
!the client browser is running - in fact, all modern browsers are designed
!specifically to prevent this, for fairly obvious security reasons...

A wet dream if I've ever seen one.
Just imagine a web app which can trigger millions of client printers to start printing.

:-)

Enabling a client to print a page, with the ability
to select a printer they have installed, is as simple as :

<input type="button" value="Print" onClick="window.print()">
or
<a href="javascript:window.print()">Print</a>

If you don't want to show the button, or the text "Print", you could use :

<body onLoad="window.print()">
....and advice the user that the printer dialog will be shown, in the referring link.

While asp.net developers deal mainly with server events,
it's easy to downstream a choice to a client using Javascript.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message news:OC**************@TK2MSFTNGP04.phx.gbl...
"David C. Barber" <da***@NOSPAMdbarber.comwrote in message news:_Z******************************@comcast.com. ..
>"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OF**************@TK2MSFTNGP04.phx.gbl...
>>"David C. Barber" <da***@NOSPAMdbarber.comwrote in message
news:zZ******************************@comcast.co m...

my.computer.printers.defaultprinter doesn't exist in 2005, despite the
plethora of examples still out on the web detailing its use.

So how can I determine a person's default printer using ASP 2?

You can't - ASP.NET has no way of interfacing directly with the hardware
on
>>the machine on which the client browser is running...

What use would this information be anyway...?
>I have a user printing out of the Crystal Reports Viewer control version XI
R2. I need to know when they are printing, and unlike the VB6 version of
this control where you could trap the Print Event on the control itself,
there is no option for that in ASP that I've been able to determine.
Indeed not... WinForms and WebForms are *totally* different... When a webserver (IIS or whatever) streams down a page
to a client browser, it has no further interaction with that client browser until / unless that client browser sends
it another HttpRequest - there is no permanent connection...

Controlling and querying printers is a breeze in a WinForms app because the app is running on the local machine. This
isn't the case with ASP.NET, which runs on a webserver not the client machine.
>Even if it's harder to determine the default printer for a user, it should
hardly be impossible. But I don't know what to try next in this regard, and
was hoping for some help here.

Natively, you have no chance whatsoever of doing this... As I said, a web application has no way of interfacing
natively with the hardware on which the client browser is running - in fact, all modern browsers are designed
specifically to prevent this, for fairly obvious security reasons...

Your only hope would be to use something like WSH, but that would only work in IE (it's ActiveX) and would require you
to seriously ramp down your security - I can't advise you to even consider this...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 25 '07 #4
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eQ**************@TK2MSFTNGP05.phx.gbl...
re:
!Natively, you have no chance whatsoever of doing this... As I said, a
web
!application has no way of interfacing natively with the hardware on
which
!the client browser is running - in fact, all modern browsers are
designed
!specifically to prevent this, for fairly obvious security reasons...

A wet dream if I've ever seen one.
Just imagine a web app which can trigger millions of client printers to
start printing.
Indeed!
:-)

Enabling a client to print a page, with the ability
to select a printer they have installed, is as simple as :
Ah yes, but that's not what the OP wants... The OP wants some way of
interrogating the hardware settings on the machine on which the client
browser is running to find out the name of the default printer - and that's
just not going to happen natively...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pablo | last post by:
Friends, how can i get the name of the default printer??. I'm working with winforms. VB,C#, nevermind. Thanks a lot Pablo
0
by: Esmee | last post by:
Hi there, I have created an Access 2002 db which contains several reports. Some reports need to be printed on a Laserjet and others on a Labelprinter. One of my clients wants to be able to print...
2
by: MLH | last post by:
I would like to allow users to set, as an application default, a specific printer to send reports to. I don't know how to bring up a list of valid print devices in A97, nor do I know how to...
2
by: Willem | last post by:
Hi, I'm trying to get the default printer using WMI. I use the following code: Private Function GetDefaultPrinter() As String Dim objWMIService As Object Dim colInstalledPrinters As Object...
1
by: i8mypnuts | last post by:
Could someone please help? I am using the 'defaultprt.zip' tool provided by Ken Getz to change the default printer via VBA code (code below). My problem is that once the default printer has been...
1
by: groulder | last post by:
hi all, i have a problem with a network database that's used by a lot of people. people are finding, they will start the database, and if the mouse is moved over the print icon, the tooltip...
2
sashi
by: sashi | last post by:
Set default printer You will often find yourself in a position where you have designed a report format for one printer and when that report is sent to another printer the layout is messed up. ...
2
by: David C. Barber | last post by:
my.computer.printers.defaultprinter doesn't exist in 2005, despite the plethora of examples still out on the web detailing its use. So how can I determine a person's default printer? Thanks!
3
by: brianflannery | last post by:
Greetings all! My problem is this. I've installed a new printer on my computer. This is the "default printer" for access. Now, some of my reports, which were working fine with the old printer,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.