open ms doc,docx or image file in browser in c# - asp.net-mvc-2

I have developed the asp.net mvc application. my one form have the file upload control. so in details view i want to implement the facility to view the uploaded document in browser itself. it should not ask for download and should not open MS office instance to open document. its a user req. It should opens in view mode in browser itself. what code i have to do ? I am using C# as language.

It is not straight forward. For images you can use <img>tag and link to the location in server where you saved the uploaded image. That should work.
However ASFAIK showing the doc/docx things in web page itself is not possible. You will have to employ some third party control to achieve that. Search google to find such controls. May come at a cost.

Related

Editing Word Documents from Web Server

I have looked for a solution to this but all I have found are products that are close but not what I need.
We have a program that creates a word document on the fly based on data from our database, and stores it on our server, then the user can download this file to print,email,file away.
I need something that will allow the user to open the existing document from the server, edit it, and save it back to the server.
I need this to be able to work on all browser, so activex isn't a full solution.
This link is a proof of concept of using CKEditor to do what you describe.
The focus is on ensuring that the "long tail" of possible docx content is preserved across the editing process.
For example, take a look at the Microsoft demo docx, which they use to compare their web apps with Google Docs, at
google-documents-vs-word-web-app

In Linux: Importing of Existing PDF Forms and Adding Submit Buttons

I'm trying to save post data from a PDF file to my web server. I don't have commonly available Windows tools, because I'm on Linux.
When using Linux software like Scribus, I am not able to successfully import the existing PDFs correctly... these are often critically accurate legal documents, which must appear exactly the way they've been designed.
I've used a web application (PDFecape.com) to add form fields to the PDF... I've autopopulated these fields on the server before showing the user. This application does not allow for a submit button.
I then used "Wine" to run Windows software called Soda PDF to add a submit button and a URL for submission.
It uses Javascript to submit the form, which from what I've read, seems to be the right approach. However, the server is not being pinged by PDFs when the button is pressed.
The URL for submission is a simple PHP script that saves post content as a PDF and sends me an email.
I've tried it in Ubuntu's built in PDF document viewer, Chrome's built in PDF reader, and have download Adobe's Acrobat Reader to try submitting with that as well.
In each case, the server is not being pinged.
Is there another way to add a submit button to this form? Any other ideas?
Thanks,
Jason Silver

ASP.net MVC2 File upload control for a separate progress bar

I would like to find out if there are any good controls available whereby I can upload files (upto 2GB) in a .net mvc2 application. The main issue is that I want to be able to retrieve the upload progress information from this control and have my own progress bar (which is already used in the application for other purposes) to display this information. Any help will be appreciated!
Plupload is a popular plugin. You may also checkout an example.

how to open a file in iWork in the iPad

From what I understand, UIApplication -openFile can open files externally, the application depending on the URL scheme. Say I have a pages (or word maybe?) document, and I want to open it in pages from my app. Does anyone know the URL scheme for me to do that? Is there a list anywhere? (Keynote, and Numbers would also be useful).
It doesn't work that way because you cannot transmit the file via a URL and Pages cannot access a file that is stored in your app's sandbox.
If you want to give the user the option to open a file in Pages in your UI, UIDocumentInteractionController is the way to do that. It presents a UI where the user can preview the file and select to open it in any application that supports the file type.
AFAIK it is not possible with the SDK to do this completely programmatically, i.e. without user interaction.

How do I integrate MS Word into a web page?

I have a section of a web application I’m working on where there are mail merge templates. The documents are word documents. When a user has need to edit the template I’d like them to be able to simply click edit, which would cause word to load with the document loaded. When the user is done, they click save in word and the web page spots the change in the file and pushes this back to the server.
I managed to create a VBScript in a web page that could do all of this, but only when internet explorers security was turned down. The fact that I’m using VBScript to automate is not good as it restricts the browser choice and I’m not happy asking my users to turn their security down.
I don’t want the users to download the file, edit it, save it to their local machine and then upload it back to the server, it’s all very clunky. I also know that there are 3rd party controls that allow editing in a page, but I'd rather avoid them if I can.
Is there an alternative way of approaching this?
You can use Office Open XML to generate the word documents on the Server Side. There is an msdn article, sorry no time to go searching for it, explaining why you should not automate office from web servers using COM/DCOM because of security issues involving shared memory.
you could use google docs API, which is certainly more universal than using proprietary technology that works in one and only browser (IE).
I think you can go for the google docs API. It is more generic solution to go for too.
It is possible, with browser-security caveats, to open Word documents for edit from a browser via an UNC path on an internal network.
The best option currently is to WebDAV enable your website, and use the SharePoint plug-in client-side to open the file in Word over WebDAV.
The SharePoint plug-in for IE gets installed when you install Office. There is also a plug-in for Firefox/ Chrome referred to as NPAPI. Beware NPAPI seems to have an issue with long URL paths.
IT Hit make a terrific framework for WebDAV enabling a .NET-based website, see http://www.webdavsystem.com/. They also sell a client-side library that can open Word documents via Java instead of the plug-ins mentioned above. IIS has it own, more basic, WebDAV capability that you can use too.
I am not familiar with non-.Net / Apache solutions but just search for WebDAV products.
Office will require the use of HTTPS for editing via WebDAV.