██████╗ ██████╗ ████████╗██████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔══██╗╚══██╔══╝╚════██╗██╔══██╗██╔══██╗██╔════╝
██████╔╝██████╔╝ ██║ █████╔╝██████╔╝██║ ██║█████╗
██╔═══╝ ██╔═══╝ ██║ ██╔═══╝ ██╔═══╝ ██║ ██║██╔══╝
██║ ██║ ██║ ███████╗██║ ██████╔╝██║
╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝
ppt2pdf — download, convert, merge, compress right from your terminal!
ppt2pdf is a command-line utility that downloads presentations (PPT, PPTX, Google Slides) and PDFs from a Google Drive folder, converts presentations to PDF as needed, and merges selected PDFs into a single file.
This document describes how to install, configure, and use the tool.
- Fetch presentations and PDFs from a Google Drive folder
- Preserve a user-specified order (supports individual indices and ranges)
- Convert PPT/PPTX/Slides to PDF using LibreOffice headless
- Include existing PDFs without conversion
- Merge PDFs with
pypdfand optionally compress the result with Ghostscript - Clean up intermediate files automatically (safe default)
- Python 3.10+ (3.11 recommended)
- LibreOffice (for PPT/PPTX -> PDF conversion)
- Ghostscript (optional, for PDF compression)
Platform install notes:
-
macOS (Homebrew):
- LibreOffice:
brew install --cask libreoffice - Ghostscript:
brew install ghostscript - Python 3.11:
brew install python@3.11
- LibreOffice:
-
Ubuntu / Debian:
- LibreOffice:
sudo apt update && sudo apt install -y libreoffice - Ghostscript:
sudo apt install -y ghostscript
- LibreOffice:
-
Windows (recommended: WSL):
- Install WSL2, then follow the Linux instructions inside the WSL environment.
- Alternatively, use Chocolatey (
choco install libreoffice ghostscript python) but behavior may vary.
Create and activate a virtual environment and install Python dependencies:
python3.11 -m venv .venv || python3 -m venv .venv
source .venv/bin/activate
.venv/bin/pip install -r requirements.txt- In the Google Cloud Console enable the Google Drive API for a project.
- Create OAuth 2.0 credentials (Application type: Desktop app).
- Download the credentials JSON and save it as
credentials.jsonin the project root.
On first run the tool opens a browser to authorize access and caches a token.json file.
Run the tool and follow the interactive prompts:
source .venv/bin/activate
python main.pyThe repository includes convenience helpers:
scripts/bootstrap.sh— creates.venv(preferspython3.11if available) and installs dependencies. Make it executable if needed:chmod +x scripts/bootstrap.sh.Makefiletargets:make setup— runs the bootstrap scriptmake run— runs the CLI using the virtualenv pythonmake clean— removes.venvanddownloads/
Examples:
./scripts/bootstrap.sh
# or
make setup
make run
# or
source .venv/bin/activate && python main.py- Paste a Google Drive folder URL or raw folder ID (both accepted)
- Choose ordering: press Enter or type
dfor default order, ormto enter manual order - When manual: enter indices and ranges (examples:
3,1,2,3-8,1-2,9-11,5,2-4); ranges may be ascending or descending - Choose whether to compress the merged PDF and the output filename/location
Command-line options (use python main.py --help):
--sort— initial sort applied before numbering (nameby default)--quality— Ghostscript compression preset (screen,ebook,printer,prepress)--work-dir— specify an alternate directory for intermediates; when omitted adownloads/folder inside the repo is used and removed after completion
- Indices are 1-based and refer to the order displayed after listing files.
- Manual input supports single indices and ranges (e.g.
3-6). - The user may specify any subset of files — the tool will download and merge only the selected items in the provided order.
- The merged PDF is written to the user-specified location.
- By default intermediate PPT/PPTX and per-file PDFs are stored in a local
downloads/folder and removed after completion or on abort. If a custom--work-diris provided, that directory is preserved by default.
The tool uses Ghostscript presets for compression. Available presets:
screen— lowest quality, smallest size (suitable for preview)ebook— balanced quality/size (default)printer— higher quality for printingprepress— minimal compression, preserves quality
- 403 / Access Denied: confirm the Drive folder is shared with the Google account used to authorize the tool; ensure the Drive API is enabled in the Cloud Console and, if the OAuth consent screen is in testing mode, add the Google account as a test user.
- LibreOffice not found: install with Homebrew:
brew install --cask libreoffice. - Compression unavailable: install Ghostscript:
brew install ghostscript.
- License: This project is licensed under the MIT License - see the
LICENSEfile.