Display ".doc" ".docx" in browser

2k Views Asked by At

My users can upload their CV and this CV should be seen by any employer.

My problem is that my client want this CV to appear in the web browser without any download.

PDF work fine but doc & docx don't.

I've tried to use both gem ("docx" and "doc_ripper") but each one can just handle basic thing (table won't work ...)

The cv is attached to one user and stored on Amazon with Dragonfly

I've try the google view : http://googlesystem.blogspot.be/2009/09/embeddable-google-document-viewer.html

But as I do : user.cv_file.remote_url(expires: 5.minutes.from_now) The url doesn't work anymore (this solution only work if the document is public)

I thought to make a second field which have the cv_file convert as a pdf if it's not.

Any possibilities to give a public permission to aws file for 2-3 min (time to render it with google view tool)

Thanks.

3

There are 3 best solutions below

0
Thounder On BEST ANSWER

Thanks for answering but after many research, I finally found :

https://view.officeapps.live.com/op/view.aspx?src=

which work as well as the pdf reader from browser.

Be sure to have a public url for the file you want to display

0
Mark B On

I assume you are talking about a file stored on S3. To make a file on S3 temporarily public you can generate a pre-signed URL with an expiration date/time: http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html

0
craig.kaminsky On

I've used the gem htmltoword a few times now and it's done a good job from that end of the translations.

I did a quick search and there are a few promising gems that might help you out here - converting the resumes from Word (.doc, .docx) into an format that you can get to HTML for your views (perhaps storing this converted content in a DB table/column?).

Word docx_converter
Google Groups discussion of the issue
ydocx
docx