Telegram bot MVP for temporary PDF conversion and basic PDF tools.
- Convert file/image to PDF
- Images:
.jpg,.jpeg,.png,.webp,.tif,.tiff,.bmp - Text-like:
.txt,.md,.csv,.log, basic.html - Office files:
.doc,.docx,.xls,.xlsx,.ppt,.pptx,.odt,.ods,.odp,.rtfif LibreOffice is installed
- Images:
- Merge multiple PDFs
- Split one PDF into one-page PDFs returned as a ZIP
- Compress PDF with low/medium/high compression
- Admin-gated
/admin - Privacy-first temp storage: uploads are deleted after processing by default
Copy .env.example to .env and edit:
BOT_TOKEN=put-your-bot-token-here
ADMIN_IDS=519613720
DELETE_UPLOADS_AFTER_PROCESSING=true
DELETE_OUTPUTS_AFTER_SENDING=true
KEEP_FAILED_UPLOADS=false
TEMP_DIR=data/tmp
MAX_FILE_MB=20
JOB_TIMEOUT_SECONDS=120
DATABASE_ENABLED=true
DATABASE_FAIL_OPEN=true
PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-keyStorage policy config:
DELETE_UPLOADS_AFTER_PROCESSING=true: removes uploaded files after the job is done.DELETE_OUTPUTS_AFTER_SENDING=true: removes generated output after Telegram send completes.KEEP_FAILED_UPLOADS=false: failed jobs are also cleaned. Settrueonly for debugging.
Per-user daily limits are stored in the database on users.daily_job_limit.
Set a userโs value to 0 to make that account unlimited.
Admin config:
ADMIN_IDSis a comma-separated allowlist of Telegram user IDs.- Only IDs in this list can access
/admin.
python3 -m venv .venv
. .venv/bin/activate
pip install -e '.[dev]'
python -m pdf_toolbox_bot.botFor Office to PDF:
sudo apt-get update
sudo apt-get install -y libreoffice ghostscript fonts-dejavu fonts-noto fonts-noto-cjkWithout LibreOffice, image/text/PDF tools still work, but DOCX/XLSX/PPTX conversion returns a clear error.
- Rotate the bot token before production if it was ever pasted in a chat or logs.
- Use Docker/systemd to keep the process running.
- Add a worker queue before supporting large files or OCR.
- Keep file size limits and cleanup enabled.