List Info

Thread: Printing to default printer




Printing to default printer
country flaguser name
United States
2007-07-19 15:18:34
Hi all,

I'm trying to create a simple application in ASP.NET to
print receipts via a web page to the default printer.  If
the default printer is a network printer, it doesn't work,
but I can get it to work by using a specific printer name.
(example below)

     

    dim prtr as new Printing.PrintDocument

    prtr.printersettings.printername =
"\servernamePrintername"



Be grateful for any ideas as to what I'm doing wrong !!!




--- List Settings ---
http://aspadvice.com/list
s/


RE: Printing to default printer
country flaguser name
United States
2007-07-19 16:15:11
On the client or the server? For client use javascript
document.print()

--
-Christopher
| AspInsider
http://chrisfrazier.net/
blog

(__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world
domination.


-----Original Message-----
From: John [mailto:jmorcomblueyonder.co.uk] 
Sent: Thursday, July 19, 2007 3:19 PM
To: aspnetaspadvice.com
Subject: [aspnet] Printing to default printer

Hi all,

I'm trying to create a simple application in ASP.NET to
print receipts via a
web page to the default printer.  If the default printer is
a network
printer, it doesn't work, but I can get it to work by using
a specific
printer name. (example below)

     

    dim prtr as new Printing.PrintDocument

    prtr.printersettings.printername =
"\servernamePrintername"



Be grateful for any ideas as to what I'm doing wrong !!!




--- List Settings ---
http://aspadvice.com/list
s/


--- List Settings ---
http://aspadvice.com/list
s/


RE: Printing to default printer
country flaguser name
United States
2007-07-19 16:25:21
This is Windows Form code, but you can make it fit:


Imports System.Drawing.Printing
Public Class Form1
    Inherits System.Windows.Forms.Form

'Windows Designer code 

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

        Dim moReturn As
Management.ManagementObjectCollection
        Dim moSearch As Management.ManagementObjectSearcher
        Dim mo As Management.ManagementObject

        moSearch = New
Management.ManagementObjectSearcher("Select * from
Win32_Printer")
        moReturn = moSearch.Get

    'list all printers for this computer
        For Each mo In moReturn
            Debug.WriteLine(mo("Name"))
        Next

    'give the default printer name
        Dim doc As PrintDocument = New PrintDocument
        MessageBox.Show(doc.PrinterSettings.PrinterName)


    End Sub

John Warner




> -----Original Message-----
> From: John [mailto:jmorcomblueyonder.co.uk] 
> Sent: Thursday, July 19, 2007 4:19 PM
> To: aspnetaspadvice.com
> Subject: [aspnet] Printing to default printer
> 
> 
> Hi all,
> 
> I'm trying to create a simple application in ASP.NET to
print 
> receipts via a web page to the default printer.  If the

> default printer is a network printer, it doesn't work,
but I 
> can get it to work by using a specific printer name.
(example below)
> 
>      
> 
>     dim prtr as new Printing.PrintDocument
> 
>     prtr.printersettings.printername =
"\servernamePrintername"
> 
> 
> 
> Be grateful for any ideas as to what I'm doing wrong
!!!
> 
> 
> 
> 
> --- List Settings ---
> http://aspadvice.com/list
s/
> 



--- List Settings ---
http://aspadvice.com/list
s/


RE: Printing to default printer
country flaguser name
United States
2007-07-19 16:38:26
Will be server side, (VB, ASP.NET)

----- Original Message -----
From: "Christopher Frazier" <chris.fraziergmail.com>
To: <aspnetaspadvice.com>
Sent: 2007-07-19 22:15
Subject: [aspnet] RE: Printing to default printer


> On the client or the server? For client use javascript
document.print()
>
> --
> -Christopher
> | AspInsider
> http://chrisfrazier.net/
blog
>
> (__/)
> (='.'=) This is Bunny. Copy and paste bunny into your
> (")_(") signature to help him gain world
domination.
>
>
> -----Original Message-----
> From: John [mailto:jmorcomblueyonder.co.uk]
> Sent: Thursday, July 19, 2007 3:19 PM
> To: aspnetaspadvice.com
> Subject: [aspnet] Printing to default printer
>
> Hi all,
>
> I'm trying to create a simple application in ASP.NET to
print receipts via
a
> web page to the default printer.  If the default
printer is a network
> printer, it doesn't work, but I can get it to work by
using a specific
> printer name. (example below)
>
>
>
>     dim prtr as new Printing.PrintDocument
>
>     prtr.printersettings.printername =
"\servernamePrintername"
>
>
>
> Be grateful for any ideas as to what I'm doing wrong
!!!
>
>
>
>
> --- List Settings ---
> http://aspadvice.com/list
s/
>
>
> --- List Settings ---
> http://aspadvice.com/list
s/
>
>




--- List Settings ---
http://aspadvice.com/list
s/


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )