unoserver-fastapi
Introduction
This server creates API access to Unoserver (LibreOffice) using FastApi.
Further unoserver documentation
Installation
We recommend that you use the provided Dockerfile, as the server requires LibreOffice, Unoserver, etc. And the integration of Unoserver with the python libraries is not straightforward. Install Docker and familiarise yourself with it.
docker build -t unoserver-fastapi:v0 .
docker run unoserver-fastapi:v0
Or using docker-compose
docker-compose build --no-cache
docker-compose up
Local execution
- Install the local environment using the Pipfile provided. Be aware that it is using python 3.11:
pipenv install --dev
- Run the script for the unoserver required library (tested in linux [Ubuntu]):
# Make the script executable
chmod +x allocate_local_unoserver.sh
# Run the script
./allocate_local_unoserver.sh
# After that, you should be able to run the unoserver locally and you can test it with this command:
./environments/virtenv/bin/python3 -m unoserver.server --interface localhost --port 2024
- Local run
pipenv shell
gunicorn main:app --workers 2 -b :5000 -k uvicorn.workers.UvicornWorker --timeout 60
Fonts
You may encounter a font issue with certain documents (ex: pdf). One option is to bring fonts from Windows into your system.
-
Copy the fonts under C:\Windows\Fonts (removing the .fon files)
-
Paste them in /usr/share/fonts/win (create the folder yourself)
-
Update the font cache running on the previous folder
# These commands require xfonts-utils: sudo apt-get install xfonts-utils mkfontscale mkfontdir fc-cache
System Service
To create a system service for unoserver:
nano /etc/systemd/system/unoserver.service
Copy inside the following:
[Unit]
Description=unoserver
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/unoserver
Environment=PYTHONUNBUFFERED=true
Restart=on-failure
RestartSec=3
To take effect: systemctl daemon-reload
To make the service on startup: systemctl enable daemon-reload
Notes:
- If executed on a multi-core machine, run several unoservers with different ports. here is however no support for any form of load balancing in unoserver, you would have to implement that yourself in your usage of unoconverter. For performant multi-core scaling, it is necessary to specify unique values for each unoserver's --port and --uno-port options.
- A next step may include managing multiple unoservers for the requests.
- Only LibreOffice is officially supported. Other variations are untested.
- Some samples have been downloaded from sample-videos.com
Metadata
Release files for doc2html 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| doc2html-0.0.1.tar.gz | 2.8 MB | Without provenance | Details for doc2html-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| doc2html-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for doc2html-0.0.1-py3-none-any.whl |
Total release size: 2.8 MB
Release files / doc2html-0.0.1.tar.gz
| Download URL | doc2html-0.0.1.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
117fcc65fba01528767a33f424b5c0cb4bfd5aa4d6c090c45a81c71dc90f7eab
|
|
BLAKE2b-256 checksum How to use checksums |
5370621905f21a4dd44d81dd0d07f629b4d3b899c90b31a6e4d92de3a8f256f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Release files / doc2html-0.0.1-py3-none-any.whl
| Download URL | doc2html-0.0.1-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61a599b18c42214240a6b1e743462e964e01e818e1e551882fa5480528b78fbd
|
|
BLAKE2b-256 checksum How to use checksums |
8613f80e48a8a6fe08c9b72c082091181b47b903df860638e70771cbdbd60687
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Security for doc2html 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.