473,414 Members | 1,989 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,414 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
2 1956
Hi,

Your access is limit due to the security permission granted to the
default ASP.NET user. You can change the user by using Identity tag in
web.congif.

Anyway refer to that sample that shows how to print via network printer:
http://www.sunlink.net/~rrobbins/aspdotnet.htm

You also might look at the following KB :
http://support.microsoft.com/default...;en-us;Q184291

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
Hi,

Your access is limit due to the security permission granted to the
default ASP.NET user. You can change the user by using Identity tag in
web.congif.

Anyway refer to that sample that shows how to print via network printer:
http://www.sunlink.net/~rrobbins/aspdotnet.htm

You also might look at the following KB :
http://support.microsoft.com/default...;en-us;Q184291

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

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. ...
0
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...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.