473,554 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Print PRN file

Any information on the best way to print a prn file from within a VB.Net Web
Application would be appreciated.
Thanks,
Michael Murphy
954-452-1047
md******@scs-techresources.c om
Nov 21 '05 #1
13 8492
"Michael D Murphy" <md******@scs-techresources.c om> schrieb:
Any information on the best way to print a prn file from within a VB.Net
Web Application would be appreciated.


Where should the file be printed? On the server? On the client?

Untested:

HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
<URL:http://support.microso ft.com/?scid=kb;EN-US;322090>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Thanks for the reply.
I need to print the prn file on the server.
Michael

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:Ob******** ******@TK2MSFTN GP14.phx.gbl...
"Michael D Murphy" <md******@scs-techresources.c om> schrieb:
Any information on the best way to print a prn file from within a VB.Net
Web Application would be appreciated.


Where should the file be printed? On the server? On the client?

Untested:

HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
<URL:http://support.microso ft.com/?scid=kb;EN-US;322090>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Hi

Based on my test, the code in the KB will work for ASP.NET application.
http://support.microsoft.com/?scid=kb;EN-US;322090

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
If RawPrinterHelpe r.SendFileToPri nter("PrinterNa me", "C:\test.pr n")
Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End Sub

In this way the test.prn is located on the IIS Server.
In addition we need to configure the ASP.NET process to run under the user
account which has added the "PrinterNam e" printer.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #4
Peter,
Thanks for your help!
That should do it.
Michael

""Peter Huang" [MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:7L******** ******@TK2MSFTN GXA03.phx.gbl.. .
Hi

Based on my test, the code in the KB will work for ASP.NET application.
http://support.microsoft.com/?scid=kb;EN-US;322090

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
If RawPrinterHelpe r.SendFileToPri nter("PrinterNa me", "C:\test.pr n")
Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End Sub

In this way the test.prn is located on the IIS Server.
In addition we need to configure the ASP.NET process to run under the user
account which has added the "PrinterNam e" printer.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 21 '05 #5
Peter,
If I wanted to spawn the printing of the PRN file as a new thread, what
would I have to do differently??
Michael
"Michael D Murphy" <md******@scs-techresources.c om> wrote in message
news:uc******** *****@TK2MSFTNG P14.phx.gbl...
Peter,
Thanks for your help!
That should do it.
Michael

""Peter Huang" [MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:7L******** ******@TK2MSFTN GXA03.phx.gbl.. .
Hi

Based on my test, the code in the KB will work for ASP.NET application.
http://support.microsoft.com/?scid=kb;EN-US;322090

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
If RawPrinterHelpe r.SendFileToPri nter("PrinterNa me",
"C:\test.pr n")
Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End Sub

In this way the test.prn is located on the IIS Server.
In addition we need to configure the ASP.NET process to run under the
user
account which has added the "PrinterNam e" printer.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.


Nov 21 '05 #6
Hi

We do not need to do special things, we just need to create a new thread to
run the print code.
e.g.
Private Sub Print()
If RawPrinterHelpe r.SendFileToPri nter("printerna me", "C:\test.pr n")
Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim th As New Threading.Threa d(AddressOf Print)
th.Start()
th.Join()
End Sub

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #7
Hi Peter,
Thanks for responding.
Just so I understand it correctly, I just have to spawn the print thread one
time in the form load and then every time I call the print function it will
automatically be executed in a new thread? This is my situation. I have an
XP Embedded program that runs mpeg files on the media player. I want the
player to keep playing, but if the user clicks the right mouse button, I
want to print a prn file associated with what the user is watching. Based on
what I have told you, can I still declare the new thread only once, or do I
need to declare it every time I need to print?
Thanks,
Michael

""Peter Huang" [MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:qW******** ******@TK2MSFTN GXA03.phx.gbl.. .
Hi

We do not need to do special things, we just need to create a new thread
to
run the print code.
e.g.
Private Sub Print()
If RawPrinterHelpe r.SendFileToPri nter("printerna me", "C:\test.pr n")
Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim th As New Threading.Threa d(AddressOf Print)
th.Start()
th.Join()
End Sub

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 21 '05 #8
Hi

If we spawn a new thread to run certain method, once the method exited, the
thread will exit too.
So one approach is run the thread on a method which have a while statement,
and the while statement will keep querying for a file or certain var to do
the print.
Otherwise, we need to spawn a new thread every time to run the print method.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #9
Hi Peter,
Do you think the code below will work, or am I misunderstandin g what you
have instructed me to do?
Michael

Public intPrintNow as Integer

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
intPrintNow =1
End Sub

Private Sub CheckForPrint()
While (1)
If intPrintNow then
If RawPrinterHelpe r.SendFileToPri nter("printerna me",
"C:\test.pr n") Then
Response.Write( "OK")
Else
Response.Write( "Failed")
End If
End If
Wend
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim th As New Threading.Threa d(AddressOf CheckForPrint)
intPrintNow = 0
th.Start()
th.Join()
End Sub
Nov 21 '05 #10

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

Similar topics

1
2395
by: Manfred Schwab | last post by:
Recording messages and print statements in a textfile during program execution. Is there a similar command to redirect errormessages or print statements into a standart asciifile during programm execution. I would like to echo the complete console output into a textfile and send this file as email at a certain point in time. The programm...
1
5692
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me...
7
2618
by: Ron | last post by:
Hi All, Is it possible to have Access print a report, identical to one that would print to a printer, only print to a "standard" text file? I can't find it in help and when I try to just print to a file (in the printer selection screen of the print routines) it gives me a file named what I wanted, but is just garbage. Can't read it. ...
3
2319
by: Max58kl | last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window -------------------------------------------------------------------------------- Hi I am using a program called Perl Builder which is an Integrated Development Environment for Perl scripting. I am trying to access the data in a txt file and then print the...
3
2412
by: itdaddy | last post by:
hey perl gurus! i am new to this forum cause i need help. I have done many scripts. but i want to use perl to do this: What I want to do is this. I have a QRP file that I can convert to a txt file field separated by commas or not. I want to pring each line that has an actual date to the right of the word 'DATE:' if it doesnt have a date do...
2
2684
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, # ctrl+v to paste, and ctrl+/ to select all # count words in a text and show the first ten items # by decreasing frequency
12
3518
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
5
13668
by: prakashturkar | last post by:
Hi, I am Prakash.... I have tried to print an MS Word file using the basic print utilities provided in JAVA.But while asking for printing through my own code i am getting proble for example..."The given flavour is not supported by utility" and still if i got an printout ,so.. it was not in well formate like the actual MS word File.Please help...
2
2096
by: dmorand | last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I print the elements look bigger when I print from IE 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
11
4191
by: JWest46088 | last post by:
I'm having difficulty trying to figure out how to print a text file from a hash table one line at a time. I have the text file read into the hash table and can print the text file all at once, but I can't seem to figure out how to do it one line at a time. Here is what I'm trying to do: I want the user to be able to print the text file one...
0
7539
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7819
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8055
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6170
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3589
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
858
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.