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

Discussion in 'ASP .Net' started by Amrendra Nath, Oct 20, 2003.

  1. 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
    Amrendra Nath, Oct 20, 2003
    #1
    1. Advertising

  2. Amrendra Nath

    Natty Gur Guest

    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.aspx?scid=kb;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!
    Natty Gur, Oct 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuel Lee
    Replies:
    0
    Views:
    492
    Samuel Lee
    Nov 11, 2003
  2. Maileen

    printing on network printer

    Maileen, Jul 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,015
    Stu Lock
    Jul 7, 2004
  3. xmlfreefly
    Replies:
    0
    Views:
    440
    xmlfreefly
    Apr 27, 2006
  4. Maravilloso
    Replies:
    0
    Views:
    299
    Maravilloso
    Oct 26, 2005
  5. Maileen
    Replies:
    1
    Views:
    166
    Evertjan.
    Jul 8, 2004
Loading...

Share This Page