Search code examples
asp.netpdffile-conversiondocument-management

How to preview an array of bytes which represents a file content in client browser?


We are in a need to interact with a Document Management Systems which saves file (mostly PDF & DOC & DOCX) as an array of bytes and saves also its file extension.
So, we need to build a file viewer which display files in client's browser.
We think of converting DOC files into PDF and preview converted file in browser, others think of converting array of bytes to HTML (this solution is a big question for us as we don't know how to do this and if this is available or not) and transfer rendered html.
But we don't think that these solutions are the best and cross browser solutions.

So, is there any way to do such functionality? which must be a cross browser solution?


Solution

  • The first question you have to answer is whether the users need to be able to edit the documents. If so, then your best "viewer" is going to be a the Word and Adobe client apps. Please note that in this case, you will also need to give the users the ability to upload (and possibly check-in) the edited documents.

    If the users just need read access, then you can certainly just show them an image or PDF of the file in their browser. If you go the PDF route, you will save money using Adobe reader, but it will be a "clunkier" user experience.

    If you want to give your users a read-only view, you will need to "render" .doc files into PDF's or TIFF's or PNG's or whatever. I don't recommend doing this in the browser unless ALL of your documents are VERY simple.

    If you users require a single, web-based interface for all of their rendered .doc and .pdf files, then you may want to consider using an java or activex-based document viewing applet. Daeja is the most popular vendor for this type of viewer, and it even gives your users the ability to annotate documents.

    One more note. Rendering .doc files can be a very expensive, cumbersome, and error-prone process. I've worked on numerous systems at multiple companies that have tried this, and no matter what we did or how much we spent, it never worked terribly well.

    Good luck!

    Tom Purl