Send pdf on serfer to client printer?

7 views
Skip to first unread message

Ralph Shnelvar

unread,
Apr 7, 2018, 12:13:11 AM4/7/18
to rubyonra...@googlegroups.com
Rubyonrails-talk,

I have a file on my server I want a client machine to print.


I have searched and searched ... and have found:

How to convert HTML to PDF
How to display a PDF in a new window.
How to print a window via javascript  ...

but not how to print to a physical printer (via the standard system dialogs) an invoice or ticket the way many websites do.

Ralph Shnelvar

Walter Lee Davis

unread,
Apr 7, 2018, 6:42:00 AM4/7/18
to rubyonra...@googlegroups.com
It's not really a Rails question, but what you need to add to your page is a JavaScript that calls to window.print(); Just that bit, in a script tag, before the closing /body of the page. But that's only going to work in an HTML page, not in the PDF. I don't know / believe you can / get a PDF to "auto-print" like you can a Web page.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/710468395.20180406221238%40dos32.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages