Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
2 Posts
PDF print file

You have two options here. You cannot print from the server side, you can serve the pdf as a download where the user can print it (the selection of a printer is an OS function, not the web app)

link_to "download pdf', send_file('path/to/pdf')

Or you can use javascript to print it if you have it in a hidden div, or iframe:

getElementById("pdf").print();

Person
Sr. Ruby & Rails Consultant For Hire
Sign In To Rate Post

Hello

I have a PDF file and I want to print it when I click on a button of my rails application. I also want, if it is possible, to be possible the user choose the printer to be used. How can I do that? thanks regards

2 Posts
Login to add your message