Printing an Order

Can Rails be used for printing an order in a store application that has
arrived?

Hi,

yes - why shouldn’t this be possible? You might print out an html view
or,
if this doesn’t give you enough control about the printing output, use
something like the PDF:Writer to construct an order.pdf.

Cheers,
Jan

and you may want to use railscron to constantly check for new orders,
generate a pdf if there is a new order, then send to printer(lp), or
fax(efax), or email (activemailer) , or call (asterisk).

Jan P. wrote:

Hi,

yes - why shouldn’t this be possible? You might print out an html view
or,
if this doesn’t give you enough control about the printing output, use
something like the PDF:Writer to construct an order.pdf.

Cheers,
Jan

I searched the API of the Rails for PDF:Writer. I can’t find it, is it a
foreign plugin for the Rails Framkework?

http://www.artima.com/rubycs/articles/pdf_writer.html

http://wiki.rubyonrails.com/rails/pages/HowtoGeneratePDFs

Cheers,
Jan

Jan P. wrote:

http://www.artima.com/rubycs/articles/pdf_writer.html

http://wiki.rubyonrails.com/rails/pages/HowtoGeneratePDFs

Cheers,
Jan

Thanks, I found those to, I was hoping though that the user might not
print from acrobat reader, but from a web-page just pressing a print
button. But I guess Rails is not that low-level.

Hey, of course this is possible too as I wrote earlier.

You might for example put together a print.rhtml view which puts out a
simple layout optimized for printing and put

There’s no magic in printing webpages… Rails is as low or high level
as you want it to be…

Cheers,
Jan

Leon L. wrote:

and you may want to use railscron to constantly check for new orders,
generate a pdf if there is a new order, then send to printer(lp), or
fax(efax), or email (activemailer) , or call (asterisk).

Nah, all I want is to print some standard orders for a BookStore, like
the ones that they put it in the book once the book is lended to you.

Jan P. wrote:

Hey, of course this is possible too as I wrote earlier.

You might for example put together a print.rhtml view which puts out a
simple layout optimized for printing and put

There’s no magic in printing webpages… Rails is as low or high level
as you want it to be…

Cheers,
Jan

And it sends the optimized webpage right to the printer? Well, I need
the secretary to complete a form, and just press the print button so the
webpage or pdf prints. Problem is how do I choose a printer? If that
works, hey, no comment to Rails!

Andreas S. wrote:

N/a N/a wrote:

Jan P. wrote:

Hey, of course this is possible too as I wrote earlier.

You might for example put together a print.rhtml view which puts out a
simple layout optimized for printing and put

There’s no magic in printing webpages… Rails is as low or high level
as you want it to be…

Cheers,
Jan

And it sends the optimized webpage right to the printer? Well, I need
the secretary to complete a form, and just press the print button so the
webpage or pdf prints. Problem is how do I choose a printer? If that
works, hey, no comment to Rails!

That’s got nothing to do with Rails. If you want to print on the client
machine, find a browser that can print without displaying a dialog, if
you want to print on the server, use a print spooler shell command like
lpr.

Yeah browsers simply do not let webpages do that. It would be bad if
you went to a webpage and your printer started freaking out and you cant
do anything about it.

Your best bet is javascript as defined above, possible in a popup
window.

Or you could do

in a javascript popup window. Or rather than a popup load it in an invisible iframe.

At the end of the day, rails just generates text with headers. If this
functionality doesn;t do what you want, the blame is with the HTTP spec
and browser security, not rails.

On 8/4/06, N/a N/a [email protected] wrote:

button. But I guess Rails is not that low-level.
Rails has absolutely NOTHING to do with printing pages from a web
browser. The combination of javascript and html that’s sent to the
web browser is what allows that behavior.

Joe

On 8/4/06, Joe Van D. [email protected] wrote:

print from acrobat reader, but from a web-page just pressing a print
button. But I guess Rails is not that low-level.

Rails has absolutely NOTHING to do with printing pages from a web
browser. The combination of javascript and html that’s sent to the
web browser is what allows that behavior.

And to clarify, you can send any html and javascript you want with
Rails (and any other technology). So, of course this is possible using
Rails.

Joe

Joe Van D. wrote:

On 8/4/06, Joe Van D. removed_em[email protected] wrote:

print from acrobat reader, but from a web-page just pressing a print
button. But I guess Rails is not that low-level.

Rails has absolutely NOTHING to do with printing pages from a web
browser. The combination of javascript and html that’s sent to the
web browser is what allows that behavior.

And to clarify, you can send any html and javascript you want with
Rails (and any other technology). So, of course this is possible using
Rails.

Joe

Thanks for the many responses, I am still grasping the principles of
rails and your response was highly appriaciated. I’ll generate some
quick appz tomrrow and see if I can get this functionality working.

If you are using CSS to layout and style your pages, you could create an
alternative CSS file for “print” which creates the optimized layout as
mentioned below. That way, you don’t need to generate multiple versions
of your page - the browser will automatically generate the print
optimized version…

I haven’t used this much, but are there issues with browser support?

Cheers
Mohit.

N/a N/a wrote:

Jan P. wrote:

Hey, of course this is possible too as I wrote earlier.

You might for example put together a print.rhtml view which puts out a
simple layout optimized for printing and put

There’s no magic in printing webpages… Rails is as low or high level
as you want it to be…

Cheers,
Jan

And it sends the optimized webpage right to the printer? Well, I need
the secretary to complete a form, and just press the print button so the
webpage or pdf prints. Problem is how do I choose a printer? If that
works, hey, no comment to Rails!

That’s got nothing to do with Rails. If you want to print on the client
machine, find a browser that can print without displaying a dialog, if
you want to print on the server, use a print spooler shell command like
lpr.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs