Display docx or ppt in browser with ruby - ruby-on-rails

I'm currently working on a intranet webapp for a company.
I've created it so the administrators of the site are able to upload files
(.docx, .pdf, .xlsx, .ppt etc) up to the webapp, to provide easier access
to documents for the employees. It works very well, however my client wasn't
too fond of having to download the files, and wanted it to pop up in the browser,
or open up the file-spesific program instead of download.
I was playing with some ideas:
1. Somehow parse the files to JSON at upload, and then show the content in browser with html.
2. Generate a pdf from the uploaded file (which automatically launches in the browser).
3. Somehow use a previewer to show the filecontent in the browser
4. Clients computer launches the uploaded file automatically on download, however I think this is a bit more tricky...
What would be the best and most time-efficient way to go about this?

It feels like what you actually want/need is a javascript document viewer (only) such as http://viewerjs.org/.

Related

new google site - How to upload a pdf

I would like to upload the pdf of a paper on my new google site. Specifically, I want that people can click on, say, "paper_title" and can visualize the pdf and, if they want, download it.
I would like if possible a step-by-step explanation.
Thanks!
This is fairly straightforwards:
Firstly, store the PDF files on Google Drive and, set the link sharing as appropriate (e.g. anyone with link can view) so even anonymous internet users can see the file.
To make the PDF available via Google Sites you can either:
From Drive, copy the link to the file, and in new Sites insert a text box and
include the hyperlink to the PDF file in the text box.
in new Sites Insert (From Drive) and select the PDF file from the Google Drive; gives the same result as above, but with a re-sizable thumbnail picture of the PDF file instead of a link.
Exactly what happens after they click on the link is going to depend upon what browser the user is using, and what (if any) PDF viewer plugin is installed. Chrome, pretty much does what you want: it opens the PDF file in a viewer, from where you can download it.
Even if you don't store the PDF on Google Drive, what is described above should still work, as long as you have a hyperlink to the PDF file.

Make pdf file accessible through a link in the app

I've been searching for weeks on stackoverflow and google, but I wasn't able to find any good results.
I have a pdf file on my computer and I want to access that pdf file from an ios app, by clicking a link which will take me to that pdf file.
And when I modify that pdf file on my computer I want the link in the app to update with the latest version of that pdf file.
I thought of using a backend for storage such as Firebase storage but I had some issues with that.
How can I access that pdf file from an app? It doesn't have to be through a link, anything that will allow access with the latest version of the file is fine.
I appreciate any suggestions.
Thank You
The simplest way may be using a cloud storage such as Dropbox, Google Drive, One Drive...etc and get the public share link to that file. Then you can load the PDF in your iOS app using this link.
You can do this using web services API, You need to create simple webservice in backend (in any language for example PHP) to get the list of file with path to access in mobile app, and configure backend webservice code to your server (your computer, wherever you want to update files), So you can get every time updated data (files path) using webservice.

Is it possible to print to a local printer with CFFILE?

I'm building an application in ColdFusion that lets the user choose a group of photos and will let them be printed automatically, however, I need to print the file and not the webpage holding the images. Is this possible with CFFILE? If not what is the best way to do this?
Dan's suggestion of an Active-X control (even if it's possible) will only work for MSIE 11 and earlier. Active-X will not work for MS Edge or any non-MS browser. It's not a global, future-proof solution.
The best solution will be to convert the images to a multi-page PDF file as TRose suggests. You will then present the file to the user to download or view in the browser. The user will have to manually print the PDF file.
Here's why: ColdFusion is a server-side applicaiton server. It crafts content that is viewable via a web browser. For security reasons, web browsers cannot automatically aceess a user's local computer(1) and therefore cannot connect to any printer connected to that computer.
(1) This is also why we can't upload files without user interaction.

open an excel file located on the server instead of download it MVC

I'm building a Reporting web application right now with MVC3 and I've come up to a couple problems.
My goal is to have it able to generate and view Crystal Reports, SSRS reports, and Excel documents.
Right now I'm working on the Excel segment and I'm running into more trouble than I thought I would. First off, when I link directly to the file, it either opens inside the browser or it downloads it from the server and if the user makes changes it doesn't actually save it to the true file on the server.
I've tried both linking to the file directly using Razor and a ViewModel with the path to the document as well as directing it to an action that returned a File.
I've also tried linking it to a shortcut to the actual file thinking that if I could open the shortcut it would open the file the way I wanted it to and unfortunately it didn't really open at all.
The users already have access to the files on the server through a network drive, so as of right now they can go into the server, open the excel document, edit and save it no problem. I want to duplicate this effect through a link. The program already has a file browser built, so I can browse between the files and make links to the reports.
Thanks in advance!
Since they are apparently on a network drive, you can just link to the files directly, relative to the user?
For example: a link to file://///SERVERNAME/folder/
I tested it between two computers on the network, and that seems to work. However, you still get a popup asking that you want to do with the file, open or save. (both in firefox and IE)
Note: Yes, that many slashes seem necessary, lol

Open a file that is on a file server from a webpage?

I am working on an internal application. We have a website that displays all our SSRS reports for a group of work. I have been asked to see if I can link all the files (pdf, word, excel) for the group of work. These files are stored on a file server that users viewing the reports have access to. Each group has its own group of reports and shared files.
Is it possible to open the files (without downloading them) from a webpage? Meaning that they file is opened from the file server? I don't want people to download a copy of the file.
I am pretty sure this can work with IE because sharepoint does it. However, other browsers may have an issue.
EDIT: What I would like is to have a web page with links to the files. When they click on a link (say for a word doc), word will open the file that resides on the file server. Without out a local copy downloaded from the network share.
EDIT2: Please note, I know what I am asking is probably not possible in all browsers. I am more or less just making sure. It seems possible in IE using activeX, but out side of that browsers do a good job at keeping processes inside a sandbox.
3 options. Remember this is for an internal website.
link to the share using file://. This will have the side affect of downloading the file to be viewed. As long as user clicks open every time it should not be a big deal.
Use JavaScript and activeX to open word (excel, reader, ect) passing in the file path as a command line arguments. This works only in IE and in win7 (probably vista) user will get a pop up asking if it is ok for the activeX control to run.
Create a new protocol. openfile://. This would be set up to run an application that is installed on the client machine which would open the file. Since it is internal, the application could be installed on the machines without issues. This also requires a registry change.
I haven't picked one as this change is still being looked into but i figure I would update this in case someone runs into something similar.

Resources