Skip to main content

a tool to export invoice and receipt fromlibreoffice calc into pdf file

Project description

a tool to export invoice and receipt from libreoffice calc into pdf file

virtualenv has to be created with option --system-site-packages as it needs to use system site-packages which has uno module installed by $ sudo apt-get install python3-uno, on Ubuntu. (Unfortunately, uno module is not available from pip.)

The code is based on Christopher5106’s tutorial (many thanks to him):

('',    'libreoffice-automate-your-office-tasks-with-python-macros.html')

How it works

  • we open LibreOffice with socket open
  • we use Python to send commands to LibreOffice through the socket (you should use iptables to block incoming connection on the specified TCP port for security reason)

To open LibreOffice with socket open, use the command line below:

libreoffice \


  • On Ubuntu 14.04

  • install python3-uno as a system-wide package as this package is not available via pip:

    $ sudo apt-get install python3-uno

  • create virtualenv (probably, with virtualenvwrapper) with --system-site-pacakges:

    $ mkvirtualenv --system-site-packages invrcptexporter

  • install required packages from pip:

    $ pip install -r requirements-test.txt

  • install poppler-utils from apt as we have to use pdftotext in our tests:

    $ sudo apt-get install poppler-utils

    I have tried a few other alternatives such as extractText() from PyPDF2, it doesn’t work for many cases

  • configure ~/.invrcptexporterrc:

    $ cd ~   $ cp /your/project/path/source/invrcptexporterrc .invrcptexporterrc

    adjust settings in this rc file, the most important one is SCRIPT_PATH which is the absolute path to ‘source’ directory

  • run the test:

    $ /your/project/path/source/

    notes: is a hack (you can see details from comments inside ), each time you run it, you have to manually close (exit or ctrl+q) the opened libreoffice ui so that the test will continue to run


  • install python3-uno as a system-wide package as this package is not available via pip:

    $ sudo apt-get install python3-uno

  • install invrcptexporter from pip:

    $ pip3 install invrcptexporter

  • use /sample_invoice_list.ods as the template

  • the program is currently shipped as a library only, please see sample codes for how to use it from: /source/sample-code/invrcptexporter/

Project details

Download files

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

Built Distribution

invrcptexporter-0.3.1-py3-none-any.whl (6.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page