A simple script I wrote to quickly convert various document formats to PDF and merge PDFs. It's not fancy, but it gets the job done when I need it every couple of months.
- Converts .doc, .docx, .ppt, and .pptx files to PDF
- Merges multiple PDFs into one
- Works from the command line
- Python 3.7+
- LibreOffice (for converting docs)
- PyPDF2 and Click (Python libraries)
- Clone or download this repo
- Install the required Python libraries:
pip install PyPDF2 click - Make sure LibreOffice is installed on your system
Convert files:
python converter.py convert /path/to/docs /path/for/output
Merge PDFs:
python converter.py merge /path/to/pdfs output.pdf
Convert:
just convert
Merge:
just merge output.pdf
Convert and merge:
just convert-and-merge final.pdf
- This is a personal script, so it might need tweaking for your setup
- It's not extensively tested or error-proofed
- Feel free to modify it to suit your needs
If something doesn't work:
- Check if LibreOffice is installed and accessible from command line
- Make sure you have the right Python libraries installed
- Double-check your file paths
That's pretty much it. Hope it's useful!