Metadata-Version: 2.4
Name: pylokit
Version: 0.8.1
Summary: Python CFFI wrapper for LibreOfficeKit
Home-page: https://github.com/xrmx/pylokit
Author: Riccardo Magliocchetti
Author-email: riccardo.magliocchetti@gmail.com
License: MPL 2.0
Platform: OS Independent
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business :: Office Suites
License-File: LICENSE
Requires-Dist: cffi
Requires-Dist: six
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: requires-dist
Dynamic: summary

pylokit
=======

A python CFFI wrapper for LibreOfficeKit. Tested in cpython2,
cpython3, and pypy.

Requirements
------------

An installation of LibreOffice >= 4.3.0 is required on the same machine.

If you are using cpython you need *libffi-dev* in order to compile CFFI.

Installation
------------

.. code:: bash

    pip install pylokit

Examples
--------

A basic conversion from a rtf file to a doc:

.. code:: python

    from pylokit import Office
    import os

    lo_path = "/path/to/libreoffice/program/dir"

    with Office(lo_path) as lo:
        with lo.documentLoad("myfile.rtf") as doc:
            doc.saveAs("myfile.doc")

    os._exit(0)

Same conversion passing an explicit format and filter options:

.. code:: python

    from pylokit import Office
    import os

    lo_path = "/path/to/libreoffice/program/dir"

    with Office(lo_path) as lo:
        with lo.documentLoad("myfile.rtf") as doc:
            doc.saveAs("myfile.doc", fmt="docx", options="skipImages")

    os._exit(0)

The usage of a context manager is needed to properly handle LibreOfficeKit
file locking.
The use of _exit() instead of default exit() is required because in some
circumstances LibreOffice segfaults on process exit.

Acknowledgements
----------------

Project inspired by Olly Betts' `lloconv <https://github.com/ojwb/lloconv>`_.
