LibreOffice Utils
Headless (command line) operations on Word, Excel, Powerpoint and most other formats LibreOffice can handle for:
- Doc => PDF conversion (LibreOffice only)
- printing (to the system default printer only)
from Python command line using LibreOffice or Microsoft Word
.doc / .docx to PDF conversion
Convert a directory of .doc / .docx to .pdf by:
python -m loutils.doc2pdf ~/Documents
Printing
CAUTION:
The doc2print.py script can print an unlimited number of pages to an unwanted printer, possibly causing great expense or violation of private documents to a public printer. Use great care with these scripts, preferably to a local non-networked printer you are sitting next to.
python -m loutils.doc2print ~/mydocs
The -exe parameter allows selecting the printing program.
The script does not check that the files can be printed appropriately, it just prints.
Thus use the -s parameter to select only the suffixes wanted.
For example to print all Markdown files in a directory with Notepad++:
python -m loutils.doc2print ~/mydocs -s .md -exe notepad++
LibreOffice 7.2 finally fixed file globbing, but we use explict for-looping to work with older LibreOffice. LibreOffice is not thread-safe, so documents are converted or printed one at a time.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file loutils-1.4.0.tar.gz.
File metadata
- Download URL: loutils-1.4.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f6bd787f505da108780274575d086440aebf11fcb2339677c133c2fc30eccb
|
|
| MD5 |
57263bda0aa1b3a1671a38e796bcfce1
|
|
| BLAKE2b-256 |
6799990dcb9663c0c46039444dba1640fd1e149398bb553e786a521cb2333aa4
|