invrcptexporter
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):
('http://christopher5106.github.io/office/2015/12/06/openoffice-', '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 \ --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"
INSTALL for TESTING
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/test.sh
notes: test.sh is a hack (you can see details from comments inside test.sh ), 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 for USER
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/
Metadata
Release files for invrcptexporter 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| invrcptexporter-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for invrcptexporter-0.3.1-py3-none-any.whl |
Release files / invrcptexporter-0.3.1-py3-none-any.whl
| Download URL | invrcptexporter-0.3.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11ecbec689adf25e7f7f7667f92609cc643fa2602f17287766a0dbc1c5dacb0c
|
|
BLAKE2b-256 checksum How to use checksums |
0fd0d99cba5fb281761f83297afa378092763fedeadc8e6db3bfde09d1a35bef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for invrcptexporter 0.3.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.