Printer function

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

    Printer function

    Hello,

    I tried to find out how can I print a document through php. What I want,
    is to add a "print button" within a web page (something like the "Print"
    button of the explorer, but within the page).
    I tried a little bit with the printer_open() function of php but with no
    luck. I red the docs, but I couldn't understand which functions are
    required to print.

    printer_open();
    .... what else ???
    printer_close() ;

    Thanks a lot!

    Fotis.
  • Matt Mitchell

    #2
    Re: Printer function


    "Fotis Andritsopoulos" <fandrit@teleco m.ntua.gr> wrote in message
    news:42199623.5 0300@telecom.nt ua.gr...
    : Hello,
    :
    : I tried to find out how can I print a document through php. What I want,
    : is to add a "print button" within a web page (something like the "Print"
    : button of the explorer, but within the page).
    : I tried a little bit with the printer_open() function of php but with no
    : luck. I red the docs, but I couldn't understand which functions are
    : required to print.

    P.S. It's nicer to cross-post (a bit like "CC:" in email) to multiple
    groups, so that all the replies stay in the same place and nobody flames you
    for asking the same question multiple times...

    Matt


    Comment

    • Geoff Berrow

      #3
      Re: Printer function

      I noticed that Message-ID: <42199623.50300 @telecom.ntua.g r> from Fotis
      Andritsopoulos contained the following:
      [color=blue]
      >
      >I tried to find out how can I print a document through php. What I want,
      >is to add a "print button" within a web page (something like the "Print"
      >button of the explorer, but within the page).[/color]

      What good would it do to print a document from the server? Maybe you
      could get the ISP to post it to you... ;-)
      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Fotis Andritsopoulos

        #4
        Re: Printer function

        Look, I have a client-server application that displays some results
        (formed by php) and

        1) I want to print these data.
        2) I don't want to use the "Print" button of the browser.
        3) I don't want to use javascript.

        The client and the server own to me (not to the ISP) :)
        [color=blue]
        > What good would it do to print a document from the server? Maybe you
        > could get the ISP to post it to you... ;-)[/color]
        ^^^^^^^^^
        Funny ?

        Fotis.



        Comment

        • Matt Mitchell

          #5
          Re: Printer function


          "Fotis Andritsopoulos" <fandrit@teleco m.ntua.gr> wrote in message
          news:cvc5t1$286 $1@ulysses.noc. ntua.gr...
          : > What good would it do to print a document from the server? Maybe you
          : > could get the ISP to post it to you... ;-)
          : ^^^^^^^^^
          : Funny ?
          :
          : Fotis.

          Well, I for one nearly died laughing!

          Matt




          Comment

          • Derek Fountain

            #6
            Re: Printer function

            Fotis Andritsopoulos wrote:
            [color=blue]
            > Look, I have a client-server application that displays some results
            > (formed by php) and
            >
            > 1) I want to print these data.
            > 2) I don't want to use the "Print" button of the browser.
            > 3) I don't want to use javascript.
            >
            > The client and the server own to me (not to the ISP) :)[/color]

            If you're on Linux you could just use system() to send it to lpr or whatever
            your preferred print tool is. But what do you intend to use to format the
            result into nice pages?
            [color=blue][color=green]
            >> What good would it do to print a document from the server? Maybe you
            >> could get the ISP to post it to you... ;-)[/color]
            > ^^^^^^^^^
            > Funny ?[/color]

            It was supposed to be, and I laughed. Most people on this newsgroup are
            probably thinking that what you're trying to do is broken by design.

            --
            The email address used to post is a spam pit. Contact me at
            http://www.derekfountain.org : <a
            href="http://www.derekfounta in.org/">Derek Fountain</a>

            Comment

            • Ehtor

              #7
              Re: Printer function

              Fotis Andritsopoulos <fandrit@teleco m.ntua.gr> wrote in
              news:42199623.5 0300@telecom.nt ua.gr:
              [color=blue]
              > Hello,
              >
              > I tried to find out how can I print a document through php. What I want,
              > is to add a "print button" within a web page (something like the "Print"
              > button of the explorer, but within the page).
              > I tried a little bit with the printer_open() function of php but with no
              > luck. I red the docs, but I couldn't understand which functions are
              > required to print.
              >
              > printer_open();
              > ... what else ???
              > printer_close() ;
              >
              > Thanks a lot!
              >
              > Fotis.[/color]

              The "printer" family of functions is normally used to write to the local
              printer attached to the server running PHP or to a network print device.
              If that works for you (ie, the server is physically located at your
              facility), then you can use these functions. Keep in mind this will only
              work if the server running PHP is a windows machine.

              A better solution might be to use a PDF library (http://www.ros.co.nz/pdf).
              When you click the "print button" on your page, you'll launch a script that
              creates the PDF and displays it in, maybe, a new browser window using
              Adobe Acrobat on the client's machine. There are many examples available.
              I believe this project has been moved to sourceforge where there are Q&A
              forums available.

              Comment

              • Markus Ernst

                #8
                Re: Printer function

                Fotis Andritsopoulos wrote:[color=blue]
                > Look, I have a client-server application that displays some results
                > (formed by php) and
                >
                > 1) I want to print these data.
                > 2) I don't want to use the "Print" button of the browser.
                > 3) I don't want to use javascript.[/color]

                So you have a problem.

                Printing is client side, unless you want to print from your server box (as
                already stated by others). PHP is server side. You need a client side
                solution. The print button is client side, Javascript is client side. If you
                don't want to use them you need to re-invent the wheel.
                [color=blue][color=green]
                >> What good would it do to print a document from the server? Maybe you
                >> could get the ISP to post it to you... ;-)[/color]
                > ^^^^^^^^^
                > Funny ?[/color]

                In most cases if people give you funny answers they actually try to point
                you to something that should be obvious. Try to see the helping aspect in
                it, instead of getting angry.

                --
                Markus


                Comment

                • Fotis Andritsopoulos

                  #9
                  Re: Printer function

                  Markus Ernst wrote:[color=blue]
                  > Fotis Andritsopoulos wrote:
                  >
                  > Printing is client side, unless you want to print from your server box (as
                  > already stated by others). PHP is server side. You need a client side[/color]
                  What I'm thinking is to prepare a php script that connects to the
                  server's shared printer (php is running on server) and to send the data
                  to print through printer_open() etc. A possible way I found so far is to
                  build a .pdf document (through the "pdf capcabilities" of php) in order
                  to print. Is it possible to send plain text and not a .pdf document ?

                  Thanks,

                  Fotis.
                  [color=blue]
                  >
                  >[color=green][color=darkred]
                  >>>What good would it do to print a document from the server? Maybe you
                  >>>could get the ISP to post it to you... ;-)[/color]
                  >>
                  >>^^^^^^^^^
                  >>Funny ?[/color]
                  >
                  >
                  > In most cases if people give you funny answers they actually try to point
                  > you to something that should be obvious. Try to see the helping aspect in
                  > it, instead of getting angry.
                  >[/color]

                  Comment

                  Working...