Use Google Docs Viewer to open document from rails app (paperclup, cloudfiles)
In our rails application, we are using paperclip to save files to rackspace cloud clouds. We want to allow users to view files without having to download them and use the program on their computer. We found https://docs.google.com/viewer which works well
The controller has the following method:
def view
att = Attachment.find(params[:id])
redirect_to "http://docs.google.com/viewer?url=#{CGI.escape(att.file.expiring_url((Time.now + 60.seconds)).gsub(/^http:/, "https:"))}"
end
This generates the following URL:
https://drive.google.com/viewerng/viewer?url=https://snet-storage101.syd2.clouddrive.com/v1/MossoCloudFS_4a360775-1b68-41f9-884f-e62e7567af25/container//attachments/files/000 /003/488/original/AK-_Time_Recording.pdf?temp_url_sig%3Dd36797290b85f2dcd752xxxxxxe6a08951ad%26 temp_url_expires % 3D14xxxxx7408 & u = 0
Then the google docs viewer tells us:
- Sorry, there is no preview.
I suspect it has to do with the "temp_url_sig" and "temp_url_expires" parameters that are appended to the url of the pdf file.
Any ideas how we can get this to work?
source to share
No one has answered this question yet
See similar questions:
or similar: