Skip to main content

Celery task to generate a PDF from a LibreOffice document (mostly ODT).

Project description

odt_to_pdf

A Celery shared task to transform an odt file (or its UTF8-decoded representation) to PDF

Installation

pip install odt_to_pdf

Usage

Creating task

See examples/consumer/main.py

Worker

The package works with a Celery worker which can be run directly celery -A worker worker -Q odt_to_pdf -l INFO

However this requires libreoffice to be installed.

It is therefore advisable to run the worker in Docker using this image: techspaceasia/odt_to_pdf:1.0.0

The worker needs to be run in an environment which has access to

  • the Celery broker
  • the Celery result backend
  • The libreoffice executable

Development

  1. Create a network which will be accessible to both the worker and the task setter e.g.: docker network create odt_to_pdf_network
  2. Run redis in that network .g. docker run --rm --name redis --network odt_to_pdf_network redis:7.0.4
  3. Build the docker image: docker build -f docker/Dockerfile -t odt_to_pdf_worker:latest .
  4. Run the worker in the same network, optionally mounting the code into it docker run -v $PWD:/code --network odt_to_pdf_network odt_to_pdf_worker:latest watchmedo auto-restart --directory=./odttopdf --pattern="*.py" --recursive -- celery -A worker worker -Q odttopdf -l INFO
  5. Create tasks from any other container which has access to the same network (you may reuse the worker image e.g. docker run --rm --network odt_to_pdf_network -v $PWD:/code odt_to_pdf_worker:latest python examples/consumer/main.py)
pip install watchdog
export CELERY_CONFIG_MODULE=celeryconfig_local
watchmedo auto-restart --directory=./odttopdf --pattern="*.py" --recursive -- celery -A worker worker -Q odttopdf -l INFO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odt_to_pdf-1.0.4.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

odt_to_pdf-1.0.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file odt_to_pdf-1.0.4.tar.gz.

File metadata

  • Download URL: odt_to_pdf-1.0.4.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for odt_to_pdf-1.0.4.tar.gz
Algorithm Hash digest
SHA256 84eea7a62e33c278d856955eac55e498e92708d5bd2833979ce53d60b005a2ea
MD5 197af87086f02313537f2af5e745b191
BLAKE2b-256 eab35e2dbf09da6e87ba6340513d05186ca9623307d80e05c54f2707eac872e0

See more details on using hashes here.

File details

Details for the file odt_to_pdf-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: odt_to_pdf-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for odt_to_pdf-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8e3b3ca0a2d6fa3d27d6045edee252cb4d44cc05e7b6b4e6cd61183a27533c85
MD5 cecef1294dcd574aa0368a9dcdcc8deb
BLAKE2b-256 ac714d046aadb350e13af2f254022648f3973d668f16d40b7d832c4bac762d7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page