_ __ _ ___
| |/ / _ ___ | |_ |_ _|_ __ ___ __ _ __ _ ___ ____ _ __ __| | __
| ' / | | / __|| __| | || '_ ` _ \ / _` |/ _` |/ _ \|_ / | '_ \ / _` | / _|
| . \ |_| \__ \| |_ | || | | | | | (_| | (_| | __/ / / | |_) | (_| || |
|_|\_\__,_|___/ \__| |___|_| |_| |_|\__,_|\__, |\___| /___| | .__/ \__,_||_|
|___/ |_|
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.
| 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 |
| Command | Description |
|---|---|
/start |
Introduction and usage guide |
/help |
Detailed how-to |
/convert |
Convert queued images to PDF |
/cancel |
Clear your image queue |
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)
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| 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) |
Render
- Fork this repo
- Go to render.com → New → Web Service
- Connect your fork
- Set environment variables in the Render dashboard
- Deploy — Render uses
render.yamlautomatically
Railway
- Fork this repo
- Go to railway.app → New Project → Deploy from GitHub
- Add
API_ID,API_HASH,BOT_TOKENas variables - Railway detects
railway.tomland deploys automatically
Heroku
- Click the Deploy to Heroku button above
- Fill in the required env vars in the form
- Click Deploy App —
app.jsonhandles everything
Koyeb
- Fork this repo
- Go to koyeb.com → Create App → GitHub
- Set build command:
pip install -r requirements.txt - Set run command:
python main.py - Add env vars and deploy
- Pyrogram — async Telegram MTProto client
- img2pdf — lossless image-to-PDF conversion
- Pillow — image format handling
- Flask — keep-alive server
Pull requests are welcome. Please open an issue first to discuss significant changes.
Licensed under the GNU General Public License v3.0.
Made with care by KustBots · Updates Channel · Support Group