Creating a system that can display doc, docx, pdf in the browser

3.3k Views Asked by At

I'm currently working on a web application that will be a front-end to an FTP server. The server contains a few thousands of pdf/doc/docx files and every month they add a few more dozens sometimes close to a hundred files.

The current application we have uses openoffice to convert the files to pdf. Than we use pdf2swf to convert the files to swf objects which we display in the browser. In the new application all the data is found in the FTP server and we can't store/create the swf files.

We need to first resolve the url to some resource on the server than download it to a different machine and display the document in the browser.

Is there a way (preferably in python) to generate the swf objects relatively fast to our uses?

A better solution would have been something like google's document viewer api, but unfortunately their TOS doesn't approve such a use: "You may not use the Service to develop a visual document search and preview application which embeds multiple uses of the Google Docs Viewer in a single webpage for DOC, DOCX, or PPTX filetypes."

1

There are 1 best solutions below

1
On
  1. For PDF, you could be interested to use a full javascript implementation done by the Mozilla team: pdf.js. You only need to serve the pdf.js files + the pdf with your python server :)

  2. For doc/docx, you can use openoffice tools to convert them to PDF. Then back to 1. :) (if you still want to write that part yourself, unoconv is written in Python and use Python-UNO bridge)