Server Side Printing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ccg

    #1

    Server Side Printing

    I am trying to print a file from an ASP script but haven't been able
    to find any way of making this happen.

    I have an EPL (Eltron Thermal Printer language) file that is being
    generated from the script and I want a way to print this file. An EPL
    file is basically printed the same way as a postscript PRN would be
    printed. From a command prompt I can type:

    copy label.EPL LPT1

    and get the thing printed. I want to be able to do this same thing
    within ASP.

    I have tried creating a batch file and calling that from ASP using the
    code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem to
    work. I did give permissions to CMD and Command but it's still not
    working. Is that because "copy" is part of Command? I also tried
    DynuExec but that didn't do the trick either.

    Is there any way to copy a file to LPT1 from within an ASP script at
    all? How about JavaScript? I'm ok with any kind of creative
    solutions...it doesn't have to be elegant since this will only be used
    as an internal application.

    Thanks in advance for any advice or suggestions.

    Corbin G

    email me at my first name and first letter of last name at the google
    mail service domain
  • Ray Costanzo [MVP]

    #2
    Re: Server Side Printing

    What does your batch file look like and the code that you're using to
    execute it?

    --

    Ray at work
    Microsoft ASP/ASP.NET MVP


    "ccg" <blah@yahoo.com > wrote in message
    news:41dc0dd4.1 75305000@msnews .microsoft.com. ..[color=blue]
    > I am trying to print a file from an ASP script but haven't been[/color]
    able[color=blue]
    > to find any way of making this happen.
    >
    > I have an EPL (Eltron Thermal Printer language) file that is being
    > generated from the script and I want a way to print this file. An[/color]
    EPL[color=blue]
    > file is basically printed the same way as a postscript PRN would be
    > printed. From a command prompt I can type:
    >
    > copy label.EPL LPT1
    >
    > and get the thing printed. I want to be able to do this same thing
    > within ASP.
    >
    > I have tried creating a batch file and calling that from ASP using[/color]
    the[color=blue]
    > code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem[/color]
    to[color=blue]
    > work. I did give permissions to CMD and Command but it's still not
    > working. Is that because "copy" is part of Command? I also tried
    > DynuExec but that didn't do the trick either.
    >
    > Is there any way to copy a file to LPT1 from within an ASP script[/color]
    at[color=blue]
    > all? How about JavaScript? I'm ok with any kind of creative
    > solutions...it doesn't have to be elegant since this will only be[/color]
    used[color=blue]
    > as an internal application.[/color]


    Comment

    • ccg

      #3
      Re: Server Side Printing

      print.asp contains
      set wshell = CreateObject("W Script.Shell")
      wshell.run "c:\inetpub\www root\ups\print. bat"
      set wshell = nothing

      print.bat contains:
      copy c:\inetpub\wwwr oot\ups\label.e pl lpt1

      I also tried changing the path in print.bat to be the local path:

      copy y:\ups\label.ep l lpt1

      The page loads and doesn't give any errors but nothing prints.

      Thanks for your assistance.

      "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote:
      [color=blue]
      >What does your batch file look like and the code that you're using to
      >execute it?
      >
      >--
      >
      >Ray at work
      >Microsoft ASP/ASP.NET MVP
      >
      >
      >"ccg" <blah@yahoo.com > wrote in message
      >news:41dc0dd4. 175305000@msnew s.microsoft.com ...[color=green]
      >> I am trying to print a file from an ASP script but haven't been[/color]
      >able[color=green]
      >> to find any way of making this happen.
      >>
      >> I have an EPL (Eltron Thermal Printer language) file that is being
      >> generated from the script and I want a way to print this file. An[/color]
      >EPL[color=green]
      >> file is basically printed the same way as a postscript PRN would be
      >> printed. From a command prompt I can type:
      >>
      >> copy label.EPL LPT1
      >>
      >> and get the thing printed. I want to be able to do this same thing
      >> within ASP.
      >>
      >> I have tried creating a batch file and calling that from ASP using[/color]
      >the[color=green]
      >> code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem[/color]
      >to[color=green]
      >> work. I did give permissions to CMD and Command but it's still not
      >> working. Is that because "copy" is part of Command? I also tried
      >> DynuExec but that didn't do the trick either.
      >>
      >> Is there any way to copy a file to LPT1 from within an ASP script[/color]
      >at[color=green]
      >> all? How about JavaScript? I'm ok with any kind of creative
      >> solutions...it doesn't have to be elegant since this will only be[/color]
      >used[color=green]
      >> as an internal application.[/color]
      >
      >[/color]

      Comment

      • Mark Schupp

        #4
        Re: Server Side Printing

        If you run the batch file while logged onto the server does it work?

        --
        --Mark Schupp
        Head of Development
        Integrity eLearning
        Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.


        "ccg" <blah@yahoo.com > wrote in message
        news:41dc176a.1 77759250@msnews .microsoft.com. ..[color=blue]
        > print.asp contains
        > set wshell = CreateObject("W Script.Shell")
        > wshell.run "c:\inetpub\www root\ups\print. bat"
        > set wshell = nothing
        >
        > print.bat contains:
        > copy c:\inetpub\wwwr oot\ups\label.e pl lpt1
        >
        > I also tried changing the path in print.bat to be the local path:
        >
        > copy y:\ups\label.ep l lpt1
        >
        > The page loads and doesn't give any errors but nothing prints.
        >
        > Thanks for your assistance.
        >
        > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote:
        >[color=green]
        >>What does your batch file look like and the code that you're using to
        >>execute it?
        >>
        >>--
        >>
        >>Ray at work
        >>Microsoft ASP/ASP.NET MVP
        >>
        >>
        >>"ccg" <blah@yahoo.com > wrote in message
        >>news:41dc0dd4 .175305000@msne ws.microsoft.co m...[color=darkred]
        >>> I am trying to print a file from an ASP script but haven't been[/color]
        >>able[color=darkred]
        >>> to find any way of making this happen.
        >>>
        >>> I have an EPL (Eltron Thermal Printer language) file that is being
        >>> generated from the script and I want a way to print this file. An[/color]
        >>EPL[color=darkred]
        >>> file is basically printed the same way as a postscript PRN would be
        >>> printed. From a command prompt I can type:
        >>>
        >>> copy label.EPL LPT1
        >>>
        >>> and get the thing printed. I want to be able to do this same thing
        >>> within ASP.
        >>>
        >>> I have tried creating a batch file and calling that from ASP using[/color]
        >>the[color=darkred]
        >>> code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem[/color]
        >>to[color=darkred]
        >>> work. I did give permissions to CMD and Command but it's still not
        >>> working. Is that because "copy" is part of Command? I also tried
        >>> DynuExec but that didn't do the trick either.
        >>>
        >>> Is there any way to copy a file to LPT1 from within an ASP script[/color]
        >>at[color=darkred]
        >>> all? How about JavaScript? I'm ok with any kind of creative
        >>> solutions...it doesn't have to be elegant since this will only be[/color]
        >>used[color=darkred]
        >>> as an internal application.[/color]
        >>
        >>[/color]
        >[/color]


        Comment

        • ccg

          #5
          Re: Server Side Printing

          I am logged onto the server when I print it from the workstation.
          But, I assume you mean from the server itself? If so, then I have not
          tried it. The server is not setup to use this printer at all.

          "Mark Schupp" <notvalid@email .net> wrote:
          [color=blue]
          >If you run the batch file while logged onto the server does it work?
          >
          >--
          >--Mark Schupp
          >Head of Development
          >Integrity eLearning
          >www.ielearning.com
          >
          >"ccg" <blah@yahoo.com > wrote in message
          >news:41dc176a. 177759250@msnew s.microsoft.com ...[color=green]
          >> print.asp contains
          >> set wshell = CreateObject("W Script.Shell")
          >> wshell.run "c:\inetpub\www root\ups\print. bat"
          >> set wshell = nothing
          >>
          >> print.bat contains:
          >> copy c:\inetpub\wwwr oot\ups\label.e pl lpt1
          >>
          >> I also tried changing the path in print.bat to be the local path:
          >>
          >> copy y:\ups\label.ep l lpt1
          >>
          >> The page loads and doesn't give any errors but nothing prints.
          >>
          >> Thanks for your assistance.
          >>
          >> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote:
          >>[color=darkred]
          >>>What does your batch file look like and the code that you're using to
          >>>execute it?
          >>>
          >>>--
          >>>
          >>>Ray at work
          >>>Microsoft ASP/ASP.NET MVP
          >>>
          >>>
          >>>"ccg" <blah@yahoo.com > wrote in message
          >>>news:41dc0dd 4.175305000@msn ews.microsoft.c om...
          >>>> I am trying to print a file from an ASP script but haven't been
          >>>able
          >>>> to find any way of making this happen.
          >>>>
          >>>> I have an EPL (Eltron Thermal Printer language) file that is being
          >>>> generated from the script and I want a way to print this file. An
          >>>EPL
          >>>> file is basically printed the same way as a postscript PRN would be
          >>>> printed. From a command prompt I can type:
          >>>>
          >>>> copy label.EPL LPT1
          >>>>
          >>>> and get the thing printed. I want to be able to do this same thing
          >>>> within ASP.
          >>>>
          >>>> I have tried creating a batch file and calling that from ASP using
          >>>the
          >>>> code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem
          >>>to
          >>>> work. I did give permissions to CMD and Command but it's still not
          >>>> working. Is that because "copy" is part of Command? I also tried
          >>>> DynuExec but that didn't do the trick either.
          >>>>
          >>>> Is there any way to copy a file to LPT1 from within an ASP script
          >>>at
          >>>> all? How about JavaScript? I'm ok with any kind of creative
          >>>> solutions...it doesn't have to be elegant since this will only be
          >>>used
          >>>> as an internal application.
          >>>
          >>>[/color]
          >>[/color]
          >
          >[/color]

          Comment

          • Mark Schupp

            #6
            Re: Server Side Printing

            Your ASP code is trying to print on the server, not on the client. Only a
            printer attached to the server can be used the way that you describe.

            In order to use a printer on the client you will have to download the data
            file and then use client-side code to print it (will probably need a
            client-side component for that). Try asking on a client-side group.

            --
            --Mark Schupp
            Head of Development
            Integrity eLearning
            Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.


            "ccg" <blah@yahoo.com > wrote in message
            news:41dc2c79.1 83150093@msnews .microsoft.com. ..[color=blue]
            >I am logged onto the server when I print it from the workstation.
            > But, I assume you mean from the server itself? If so, then I have not
            > tried it. The server is not setup to use this printer at all.
            >
            > "Mark Schupp" <notvalid@email .net> wrote:
            >[color=green]
            >>If you run the batch file while logged onto the server does it work?
            >>
            >>--
            >>--Mark Schupp
            >>Head of Development
            >>Integrity eLearning
            >>www.ielearning.com
            >>
            >>"ccg" <blah@yahoo.com > wrote in message
            >>news:41dc176a .177759250@msne ws.microsoft.co m...[color=darkred]
            >>> print.asp contains
            >>> set wshell = CreateObject("W Script.Shell")
            >>> wshell.run "c:\inetpub\www root\ups\print. bat"
            >>> set wshell = nothing
            >>>
            >>> print.bat contains:
            >>> copy c:\inetpub\wwwr oot\ups\label.e pl lpt1
            >>>
            >>> I also tried changing the path in print.bat to be the local path:
            >>>
            >>> copy y:\ups\label.ep l lpt1
            >>>
            >>> The page loads and doesn't give any errors but nothing prints.
            >>>
            >>> Thanks for your assistance.
            >>>
            >>> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote:
            >>>
            >>>>What does your batch file look like and the code that you're using to
            >>>>execute it?
            >>>>
            >>>>--
            >>>>
            >>>>Ray at work
            >>>>Microsoft ASP/ASP.NET MVP
            >>>>
            >>>>
            >>>>"ccg" <blah@yahoo.com > wrote in message
            >>>>news:41dc0d d4.175305000@ms news.microsoft. com...
            >>>>> I am trying to print a file from an ASP script but haven't been
            >>>>able
            >>>>> to find any way of making this happen.
            >>>>>
            >>>>> I have an EPL (Eltron Thermal Printer language) file that is being
            >>>>> generated from the script and I want a way to print this file. An
            >>>>EPL
            >>>>> file is basically printed the same way as a postscript PRN would be
            >>>>> printed. From a command prompt I can type:
            >>>>>
            >>>>> copy label.EPL LPT1
            >>>>>
            >>>>> and get the thing printed. I want to be able to do this same thing
            >>>>> within ASP.
            >>>>>
            >>>>> I have tried creating a batch file and calling that from ASP using
            >>>>the
            >>>>> code at http://www.aspfaq.com/show.asp?id=2059 but that didn't seem
            >>>>to
            >>>>> work. I did give permissions to CMD and Command but it's still not
            >>>>> working. Is that because "copy" is part of Command? I also tried
            >>>>> DynuExec but that didn't do the trick either.
            >>>>>
            >>>>> Is there any way to copy a file to LPT1 from within an ASP script
            >>>>at
            >>>>> all? How about JavaScript? I'm ok with any kind of creative
            >>>>> solutions...it doesn't have to be elegant since this will only be
            >>>>used
            >>>>> as an internal application.
            >>>>
            >>>>
            >>>[/color]
            >>
            >>[/color]
            >[/color]


            Comment

            • Ray Costanzo [MVP]

              #7
              Re: Server Side Printing

              Try mapping LPT1 to a printer first.

              net use lpt1: \\server\prints hare
              copy y:\ups\label.ep l lpt1
              net use lpt1: /d


              Is Y: a local drive?

              --

              Ray at work
              Microsoft ASP/ASP.NET MVP


              "ccg" <blah@yahoo.com > wrote in message
              news:41dc176a.1 77759250@msnews .microsoft.com. ..[color=blue]
              > print.asp contains
              > set wshell = CreateObject("W Script.Shell")
              > wshell.run "c:\inetpub\www root\ups\print. bat"
              > set wshell = nothing
              >
              > print.bat contains:
              > copy c:\inetpub\wwwr oot\ups\label.e pl lpt1
              >
              > I also tried changing the path in print.bat to be the local path:
              >
              > copy y:\ups\label.ep l lpt1
              >
              > The page loads and doesn't give any errors but nothing prints.
              >
              > Thanks for your assistance.
              >
              > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial>[/color]
              wrote:[color=blue]
              >[color=green]
              > >What does your batch file look like and the code that you're using[/color][/color]
              to[color=blue][color=green]
              > >execute it?
              > >
              > >--
              > >
              > >Ray at work
              > >Microsoft ASP/ASP.NET MVP
              > >
              > >
              > >"ccg" <blah@yahoo.com > wrote in message
              > >news:41dc0dd4. 175305000@msnew s.microsoft.com ...[color=darkred]
              > >> I am trying to print a file from an ASP script but haven't been[/color]
              > >able[color=darkred]
              > >> to find any way of making this happen.
              > >>
              > >> I have an EPL (Eltron Thermal Printer language) file that is[/color][/color][/color]
              being[color=blue][color=green][color=darkred]
              > >> generated from the script and I want a way to print this file.[/color][/color][/color]
              An[color=blue][color=green]
              > >EPL[color=darkred]
              > >> file is basically printed the same way as a postscript PRN would[/color][/color][/color]
              be[color=blue][color=green][color=darkred]
              > >> printed. From a command prompt I can type:
              > >>
              > >> copy label.EPL LPT1
              > >>
              > >> and get the thing printed. I want to be able to do this same[/color][/color][/color]
              thing[color=blue][color=green][color=darkred]
              > >> within ASP.
              > >>
              > >> I have tried creating a batch file and calling that from ASP[/color][/color][/color]
              using[color=blue][color=green]
              > >the[color=darkred]
              > >> code at http://www.aspfaq.com/show.asp?id=2059 but that didn't[/color][/color][/color]
              seem[color=blue][color=green]
              > >to[color=darkred]
              > >> work. I did give permissions to CMD and Command but it's still[/color][/color][/color]
              not[color=blue][color=green][color=darkred]
              > >> working. Is that because "copy" is part of Command? I also[/color][/color][/color]
              tried[color=blue][color=green][color=darkred]
              > >> DynuExec but that didn't do the trick either.
              > >>
              > >> Is there any way to copy a file to LPT1 from within an ASP[/color][/color][/color]
              script[color=blue][color=green]
              > >at[color=darkred]
              > >> all? How about JavaScript? I'm ok with any kind of creative
              > >> solutions...it doesn't have to be elegant since this will only[/color][/color][/color]
              be[color=blue][color=green]
              > >used[color=darkred]
              > >> as an internal application.[/color]
              > >
              > >[/color]
              >[/color]


              Comment

              Working...