473,396 Members | 1,871 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,396 software developers and data experts.

Printing PDF Or Scanned Document Via ASP.NET at network Printer

Hi Friends !
Can anyone help? Its an urgent.
I wanted to print PDF Document or Scanned Document Through
my .aspx page .By just clicking a button.I'm not using
codebehind.I want to do printing at my network printer.

I'm using System.Diagnosics.Process Namespace for calling
the print process at the server where i want to do my
printing.I'm only able to run Command.exe and notepad
process. Please help.

My code :

Public Sub PrintDoc(sender as Object, ev As EventArgs)
dim ERROR_FILE_NOT_FOUND As Integer = 2
dim ERROR_ACCESS_DENIED As Integer = 5
Dim myProcess As New Process()

Try
myProcess.StartInfo.FileName =
FileName response.Write
(myProcess.StartInfo.FileName)

myProcess.StartInfo.Verb = "Print"

myProcess.StartInfo.UseShellExecute=true
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()

Catch e As Win32Exception
response.Write("error")
If e.NativeErrorCode = ERROR_FILE_NOT_FOUND
Then
Response.Write(((e.Message + ". Check the
path.")))

Else
If e.NativeErrorCode = ERROR_ACCESS_DENIED
Then
' Note that if your word processor might
generate exceptions
' such as this, which are handled first.
Response.Write(((e.Message + ". You do
not have permission to print this file.")))
End If
End If
End Try
myProcess.WaitForExit()
if Not myProcess.HasExited Then
myProcess.Kill()
End If
myProcess.Close()

End Sub
Nov 17 '05 #1
0 806

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

Similar topics

1
by: Maileen | last post by:
Hi, I have 2 questions : 1. - I want to print from my ASP page directly to my network printer. For this i use the following code, but everytime, my document to print is sent to local and...
3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
1
by: Curtis Justus | last post by:
Hi, My back is against the wall and I've tried to figure out something to do. Here is my scenario: I have an automated process running in a service that generates HTML files. Each resulting...
2
by: Ryan Gregg | last post by:
I've got a dot matrix printer that I need to print a line at a time to. This is being used for an audit log on an application and every event that occurs needs to print out right as it occurs. ...
2
by: Amrendra Nath | last post by:
Hi Friends ! Can anyone help? Its an urgent. I wanted to print PDF Document or Scanned Document Through my .aspx page .By just clicking a button.I'm not using codebehind.I want to do printing at...
7
by: ap | last post by:
Hi, It is a quick question... Is that impossible to print the page(Web Form .aspx file) in client side using GDI+ like PrintDocument pd = new PrintDocument(); pd.print(); As I know it is a...
1
by: Maileen | last post by:
Hi, I want to print from my ASP page directly to my network printer. For this i use the following code, but everytime, my document to print is sent to local and physical port LPT1 :( could you...
1
by: eskildb | last post by:
First, please be gently. I am fairly new to the programming world (1.5 years with some expermentation prior to). I have been working on a project that has to print HTML pages with graphics in a...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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...

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.