Skip to content

kustbots/image2pdfbot

Repository files navigation

 _  __          _     ___
| |/ /   _ ___ | |_  |_ _|_ __ ___   __ _  __ _  ___  ____  _ __   __| |  __
| ' / | | / __|| __|  | || '_ ` _ \ / _` |/ _` |/ _ \|_  / | '_ \ / _` | / _|
| . \ |_| \__ \| |_   | || | | | | | (_| | (_| |  __/ / /  | |_) | (_| || |
|_|\_\__,_|___/ \__| |___|_| |_| |_|\__,_|\__, |\___| /___| | .__/ \__,_||_|
                                           |___/             |_|
Typing SVG

License: GPL v3 Python Pyrogram Telegram


Kust Image2PDF is an open-source Telegram bot that converts images to PDF. Send up to 20 photos or image files, then type /convert — the bot sends back a single PDF with all your images in order.

Features

Feature Details
Photo & document support Accepts both Telegram photos and image files (JPEG, PNG, WEBP, etc.)
Up to 20 images Configurable per-session limit
Ordered conversion Pages appear in the order images were received
Cancel & restart /cancel clears your queue instantly
Keep-alive server Flask /health endpoint for hosting platforms
Modular structure Clean handler-based layout, easy to extend

Commands

Command Description
/start Introduction and usage guide
/help Detailed how-to
/convert Convert queued images to PDF
/cancel Clear your image queue

Project Structure

image2pdfbot/
├── main.py                  # Entry point — registers handlers, runs bot + server
├── config.py                # All config (API_ID, API_HASH, BOT_TOKEN, limits)
├── server.py                # Flask keep-alive server
├── requirements.txt
├── Dockerfile
├── Procfile
├── render.yaml
├── railway.toml
├── koyeb.yaml
├── app.json
├── .env.example
├── bot/
│   ├── handlers/
│   │   ├── start.py         # /start and /help
│   │   ├── photos.py        # Photo and image document handling
│   │   └── convert.py       # /convert and /cancel
│   └── utils/
│       └── converter.py     # img2pdf + Pillow conversion logic
└── downloads/               # Temporary image storage (auto-created)

One-Click Deploy

Deploy to Render Deploy on Railway Deploy to Heroku Deploy to Koyeb

Self-Host (VPS / Local)

git clone https://github.com/kustbots/image2pdfbot
cd image2pdfbot
cp .env.example .env
# Fill in your values in .env
pip install -r requirements.txt
python main.py

Environment Variables

Variable Required Description
API_ID Yes Telegram API ID from my.telegram.org
API_HASH Yes Telegram API hash from my.telegram.org
BOT_TOKEN Yes Bot token from @BotFather
PORT No Keep-alive server port (default: 8080)

Platform Guides

Render
  1. Fork this repo
  2. Go to render.com → New → Web Service
  3. Connect your fork
  4. Set environment variables in the Render dashboard
  5. Deploy — Render uses render.yaml automatically
Railway
  1. Fork this repo
  2. Go to railway.app → New Project → Deploy from GitHub
  3. Add API_ID, API_HASH, BOT_TOKEN as variables
  4. Railway detects railway.toml and deploys automatically
Heroku
  1. Click the Deploy to Heroku button above
  2. Fill in the required env vars in the form
  3. Click Deploy App — app.json handles everything
Koyeb
  1. Fork this repo
  2. Go to koyeb.com → Create App → GitHub
  3. Set build command: pip install -r requirements.txt
  4. Set run command: python main.py
  5. Add env vars and deploy

Tech Stack

  • Pyrogram — async Telegram MTProto client
  • img2pdf — lossless image-to-PDF conversion
  • Pillow — image format handling
  • Flask — keep-alive server

Contributing

Pull requests are welcome. Please open an issue first to discuss significant changes.

License

Licensed under the GNU General Public License v3.0.


Made with care by KustBots · Updates Channel · Support Group

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors