Browse the Ruby on Rails Community.

You are here: Forums General Discussion Print a PDF file...

Replytotopic

Print a PDF file

Posted in Forums : General Discussion

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this 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

 
836891

Authority 12
Posting Rating 81
Sign in to rate this post

Probably with JavaScript. In many browsers, window.print() will display the system Print dialog, exactly as if the user had chosen the browser’s Print command.

 
Photo_thumb

Authority 25
Posting Rating 0
Sign in to rate this post

I don’t think it’s possible to be honest. PDF files rely on external viewer apps. Any viewers that work in the browser are probably because your viewer supports viewing through ActiveX or something simmilar. Either way you can’t not use JavaScript.

The only way that might work, which is a hacky kludge is to use an iframe created with javascript and then call the print() method for that frame from the host frame/page.

Replytotopic

Other Recent Topics

General Discussion : Is Jruby Supports all the features same as ruby on rail

General Discussion : [ANN] Book released "Aptana RadRails: An IDE for Rails Development"

General Discussion : Template Management in rails

General Discussion : Blogs in rails

General Discussion : Quality version control and deployment...?

General Discussion : Math Learning site in Rails

General Discussion : Funny RailsConf MVC videos from RailsEnvy/FiveRuns

General Discussion : *.isonrails.com - Rails Playground online

General Discussion : host2day.com not for RoR

General Discussion : Great Rails Resource...

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel