Skip to content

Added the function of converting multiple images into single PDF

Choose a tag to compare

@ankittroy-21 ankittroy-21 released this 18 Dec 05:16
· 20 commits to main since this release

πŸŽ‰ Release v1.2.0 - Multi-Image PDF Conversion

πŸš€ Major Feature: Multi-PDF Support

We're excited to announce a major update to PDF Bot with the addition of Multi-Image PDF Conversion! Now you can combine multiple images into a single PDF document with professional formatting options.


✨ What's New

πŸ“š Multi-Image to PDF Conversion

Convert multiple images into a single, professionally formatted PDF document with ease.

Key Features:

  • Interactive Collection: Real-time progress tracking as you send images
  • Flexible Page Sizing: Choose between A4 Standard or Auto-Size modes
  • Smart Layout: Automatic image centering with white borders
  • Clean Interface: Single updating progress message (no spam!)
  • Cancel Anytime: Built-in cancel buttons at every step

🎯 How It Works

  1. Start Collection: Send /multipdf [optional_filename]
  2. Add Images: Send your images one by one or as an album
  3. Track Progress: Watch the live counter update: "πŸ“₯ Downloaded 3 image(s)"
  4. Choose Mode: Click Done and select your preferred page size:
    • πŸ“„ A4 Standard: Fixed 595Γ—842px pages with white borders
    • πŸ“ Auto-Size: Optimized to the largest image dimensions
  5. Get PDF: Receive your professionally formatted PDF!

πŸ”§ Technical Improvements

Image Processing:

  • βœ… Color normalization with sRGB profiles
  • βœ… Intelligent resizing (max 2000px dimension)
  • βœ… Optimized JPEG compression (quality: 75, progressive)
  • βœ… Professional centering with aspect ratio preservation

Page Modes:

  • A4 Standard: Perfect for printing, consistent 595Γ—842px pages
  • Auto-Size: Best for digital viewing, adapts to your images

Performance:

  • βœ… Real-time progress updates
  • βœ… Asynchronous download processing
  • βœ… Automatic cleanup of temporary files
  • βœ… Memory-efficient image optimization

πŸ“ Updated Commands

New Commands

/multipdf [filename]  - Start multi-image PDF collection
/done                 - Finish collection (or use Done button)
/cancel               - Cancel collection (or use Cancel button)

Existing Commands (Unchanged)

/start                - Display welcome message
/help                 - Show all available commands
/pdf [filename]       - Convert single image to PDF
/compress [filename]  - Compress PDF files

Benefits:

  • βœ… Visual progress tracking
  • βœ… One-click actions (no typing needed)
  • βœ… Professional, clean interface

πŸ› οΈ Technical Stack

PDF Generation:

  • PyMuPDF (fitz) for advanced PDF creation
  • Pillow (PIL) for image processing
  • sRGB color profile management

Image Optimization:

  • Maximum dimension: 2000px
  • JPEG quality: 75 (optimized balance)
  • Progressive encoding
  • Chroma subsampling: 4:2:0

Architecture:

  • Asynchronous processing with Pyrogram
  • In-memory session management
  • User-specific image collections
  • Automatic 30-minute cleanup

πŸ“‹ Example Usage

Basic Multi-PDF

/multipdf
β†’ Send 3 photos
β†’ Click Done
β†’ Choose A4 or Auto-Size
β†’ Receive PDF!

With Custom Filename

/multipdf vacation_2024
β†’ Send photos
β†’ Click Done
β†’ Choose mode
β†’ Get "vacation_2024.pdf"

Mixed with Single Images

Send photo β†’ Reply with /pdf        β†’ Single image PDF
/multipdf β†’ Send 5 photos β†’ Done    β†’ Multi-image PDF
Send PDF β†’ Reply with /compress     β†’ Compressed PDF

πŸ› Bug Fixes

  • βœ… Resolved download progress tracking issues
  • βœ… Improved error handling for failed downloads
  • βœ… Enhanced cleanup of temporary files

🀝 Contributing

We welcome contributions! Feel free to:

  • Report bugs via GitHub Issues
  • Suggest features
  • Submit pull requests
  • Improve documentation

πŸ“„ License

This project is licensed under the MIT License.


πŸ™ Acknowledgments

Special thanks to:

  • PyMuPDF team for excellent PDF library
  • Pyrogram developers for robust Telegram framework
  • Community for feature requests and feedback

πŸ“ž Support


Made with ❀️ for the Telegram community