I have a file upload control on my page. When a user selects a .DOC/DOCX file in the control, I need to show the selected file on the page but in PDF format.
I can show the PDF using embed tag as usual, but what should be the sequence be that I need to follow here?
I am using ASP.NET MVC3. Can I perform this using javacript?
I have a file upload control on my page. When a user selects a .DOC/DOCX file in the control, I need to show the selected file on the page but in PDF format.
I can show the PDF using embed tag as usual, but what should be the sequence be that I need to follow here?
I am using ASP.NET MVC3. Can I perform this using javacript?
Share Improve this question edited Feb 1, 2012 at 8:41 Stafford Williams 9,8069 gold badges54 silver badges105 bronze badges asked Feb 1, 2012 at 4:33 Red SwanRed Swan 15.6k44 gold badges161 silver badges241 bronze badges 1- Are you saying you want the user to upload a .doc/.docx, convert it to pdf, then show the user the pdf? – Stafford Williams Commented Feb 1, 2012 at 4:38
1 Answer
Reset to default 4Converting a DOCX file to PDF using javascript might be a little tough and a territory I wouldn't venture into. So once the file is being uploaded on the server you could use some standard library that will perform the conversion. There are some libraries such as Aspose.Words (mercial but very reliable) or DocX (free) which will allow you to do this. Once the file is converted into a PDF you could store it on the server and return its location so that the client can build an <iframe>
or <object>
tag dynamically pointing to it and show it inline as a preview.