I have an app built in Rails 4 (Ruby 2) that currently opens the Browser print dialog box using Javascript when a button is clicked, like so:
<%= button 'Print Me', :onclick => 'window.print();return false;' %>
I noticed in the bottom left of this dialog box is a dropdown menu for 'PDF', which has a number of options including 'Open PDF in Preview', 'Save PDF as...' and a few others (Safari and Firefox both have this, so I assume it's industry standard). I'm particularly interested in the option 'Mail PDF' for use in my application, is it possible with some Javascript to access this functionality on button click in addition to the Print action it is already performing?
Ideal result would be that a button "Print and Email" is clicked and an email client opens with an attached printout of the current window in PDF format.
It seems to me this kind of thing should be possible using a combination of Javascript and/or HTML (especially mailto: like the question linked below), but I'm not familiar enough with Rails or Javascript to figure it out on my own.
mailto: example Link to open email client and attach file?
Thanks =)