Forum: Ruby on Rails set printer on

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
rails suheimi (Guest)
on 2006-05-27 20:57
(Received via mailing list)
hi all, I'm newbie on ror. My question is:
how could I set the printer on. The logic is as follow:

set printer on

  my print stmt to printer

set printer off

thx
Rob M. (Guest)
on 2006-05-27 21:22
(Received via mailing list)
If I understand you right you want to be able to access somebodies
printer
remotely from your rails application?  As far as I know that can't be
done,
just image how bad banner ads would be if any web page could control
your
printer...

Rob
unknown (Guest)
on 2006-05-27 21:46
(Received via mailing list)
You can bring up the printer prompt on the users computer, but I
wouldn't, except maybe on a specific print friendly page which people
will only go to if they want to print, because the users will just get
annoyed at you otherwise.

<body onload="print()">

-N
rails suheimi (Guest)
on 2006-05-30 04:43
(Received via mailing list)
how about to local printer ? Say, to usb port or parallel port ? Can
it be done ?
What I'm trying to do is to print the invoice from rails apps.

thx guys
Phillip H. (Guest)
on 2006-05-30 05:31
(Received via mailing list)
On 5/30/06, rails suheimi <removed_email_address@domain.invalid> wrote:
> how about to local printer ? Say, to usb port or parallel port ? Can
> it be done ?
> What I'm trying to do is to print the invoice from rails apps.
>
> thx guys

If you're running on Linux you can create a PDF and send it through
lp, though that requires a printing system that can read PDFs - CUPS
can.
Chris H. (Guest)
on 2006-05-30 05:32
(Received via mailing list)
just create a link/button with onclick="window.print()".  ex:

<a href="#" onclick="window.print()">Click Me To Print This Page</a>

this will open the print dialog of your browser and allow you to print
to
the current page.  of course, the user will have to have javascript
turned
on in the browser for this to work.

now, if you want to do printing directly to a networked printer from the
server, that's a different topic altogether.

Chris
This topic is locked and can not be replied to.