Skip to main content

Python CFFI wrapper for LibreOfficeKit

Project description

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

Installation

pip install pylokit

Example

A basic conversion from a rtf file to a doc:

from pylokit import Office

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

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

Same conversion passing an explicit format and filter options:

from pylokit import Office

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")

The usage of a context manager is needed to properly handle LibreOfficeKit file locking.

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

pylokit-0.8.0.tar.gz (11.1 kB view hashes)

Uploaded source

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