Y
Y
Yaroslav Ogloblin2018-11-09 13:12:50
Python
Yaroslav Ogloblin, 2018-11-09 13:12:50

How to view documents of different formats in a browser?

Good afternoon.
Some solution needs to be found to allow users to view documents uploaded to the server in a browser. Similar to Google Docs and similar services.
The platform runs on Python.
So far, I see only two options - use the api of such services as Google Docs etc, upload files there and then show the user the result of the service, or run some kind of Libre Office package on the server and give the document to him, generate html in it and give it to the user.
Both options have a number of significant disadvantages.
Maybe someone else will suggest something else.
Or, if there are no other options, what service / package is better to use to implement these options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rPman, 2018-11-11
@rPman

Preliminary 'print' documents in pdf on the server, this is currently the most universal method for viewing documents, any, without formatting loss, and very often text information is not lost, i.e. these are not pictures.
with pdf in the browser it is much easier, there are javascript viewers and the client usually already has something for this, often with automatic viewing from the browser.

V
Vitaliy Orlov, 2018-11-09
@orlov0562

Another option is to generate pictures and show them to users.
In variants with conversion, there will be a lot of hemorrhoids on the side of your backend and the result will not always be satisfactory. Most likely, for each format it will be necessary to use separate utilities, study their features and further monitor their work. For example, in the case of using LibreOffice or Apache Tika. In addition, if there is a need to show content on mobile devices, generation in html is most likely not suitable, since in most cases it works line by line with positioning fixed, i.e. On mobile there will be no normal scaling.
If it is possible to use third party services like Google Docs or Office365, I would use them. There is a fairly simple integration, everything has been debugged for a long time: for example, formulas work in tables, they work fine on mobile devices. Depending on the tasks, it may be necessary to spend money on the API, but at the time when I calculated for my tasks, it was comparable to the content of my server for parsing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question