Metadata-Version: 2.1
Name: pylibreoffice
Version: 0.1.2
Summary: A Python library for handling Microsoft Office documents, built with LibreOfficeKit.
Home-page: https://github.com/begonia-org/pylibreoffice
Author: vforfreedom
Author-email: vforfreedom <vforfreedom96@gmail.com>
Project-URL: Homepage, https://github.com/begonia-org/pylibreoffice
Project-URL: Issues, https://github.com/begonia-org/pylibreoffice/issues
Project-URL: Documentation, https://github.com/begonia-org/pylibreoffice
Project-URL: Repository, https://github.com/begonia-org/pylibreoffice.git
Keywords: egg,office,libreoffice,doc,ppt,xls,docx,xlsx,pptx,pdf,libreofficekit,cython,pybind11
Platform: Linux
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Cython
Requires-Dist: pybind11

# pylibreoffice

A Python library for handling Microsoft Office documents, built with [LibreOfficeKit](https://docs.libreoffice.org/libreofficekit.html).

## Features

- Convert Microsoft Office documents to PDF

## Installation
### Requirements
- Python 3.10 or higher

- LibreOffice 7.2 or higher
```bash
sudo apt-get install -y libreoffice libreoffice-dev libreoffice-dev-doc
```

- The fonts used in the document must be installed on the system.For example,use Chinese, on Ubuntu, you can install the fonts by running the following command:
```bash
sudo apt-get install -y fonts-wqy-zenhei fonts-wqy-microhei xfonts-intl-chinese ttf-wqy-zenhei ttf-wqy-microhei language-pack-zh-hans language-pack-zh-hant && \
sudo dpkg-reconfigure locales && \
sudo update-locale LANG=zh_CN.UTF-8
```

```bash
pip install pylibreoffice
```

## Example

```python
from pylibreoffice.py_office import PyOffice


class Example:
    def __init__(self):
        self.office = PyOffice("/usr/lib/libreoffice/program/")

    def doc(self):
        # Convert the doc file to pdf
        print(self.office.save_as("./test.doc", "./test.pdf", "pdf"))

    def xls(self):
        # Convert the xls file to pdf
        print(self.office.save_as("./test.xls", "./test_xls.pdf", "pdf"))


if __name__ == '__main__':
    ex = Example()
    ex.xls()
    ex.doc()
```
