Re: [Rails] Display PDF from Amazon S3 in new window for iPad etc.
On 7 May 2011 05:51, Dan Sadaka <lists@ruby-forum.com> wrote:
> Hello RoR experts,
>
> I am trying to display a PDF stored out at Amazon S3 (private) using a
> keyed, expiring URL in a new window.
>
> I cannot display a direct link to the PDF (since it expires), instead I
> use a link to the show method, which does the following
>
> <div id="tt">
> <embed src="<%= @book.file_path %>" width="100%" height="100%"
> allowfullscreen="true">
> <script type="text/javascript">
> $('#tt').show();
> </script>
> <p></p>
> </div>
>
> (where @book.file_path returns the keyed URL to the PDF)
>
> This displays the PDF in a popup window however, I just want to display
> the PDF in a NEW browser window or, even better, in the native PDF
> viewer.
>
> I need to do this because on mobile devices (read iPad), this popup
> doesn't work well. It draws the popup at the top of the page and the
> user cannot see it unless he/she scrolls to the top. Even if they do
> find it, the native behavior of the iPad PDF viewer--which is pretty
> nice--is not there. i.e. I want it to behave just like it would if the
> link were directly to the PDF.
>
> I have tried window.open('mypdfpath') and many other combinations.
>
> Is anyone doing this or have an idea how to approach it?
Can't you just make 'show' action redirect to the S3 URL (i.e. using
the 'redirect_to' method)?
Chris
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home