PDF Converter
A simple and efficient Rust library for converting images to PDF documents with support for multiple formats and commercial use.
โจ Features
- ๐ผ๏ธ Multi-format Support: JPG, PNG, GIF, BMP, WebP
- ๐ Single & Batch Conversion: Convert individual files or entire folders
- ๐ Smart A4 Fitting: Automatic scaling with proper margins
- โ๏ธ Configurable: Custom DPI, margins, page size, document title
- ๐ Performance Optimized: Memory-efficient processing
- ๐ผ Commercial Friendly: MIT/Apache-2.0 dual license
- ๐ ๏ธ Production Ready: Comprehensive error handling and testing
๐ Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Basic Usage
use PdfConverter;
Advanced Configuration
use ;
๐ Performance
- Single image: ~1 second
- Batch (4 images): ~6 seconds
- Memory: Optimized for large files
- Quality: 100-300 DPI support
๐งช Testing
Run the comprehensive test suite:
Or quick validation:
๐ Project Structure
src/
โโโ lib.rs # Public API
โโโ converter.rs # Core conversion logic
โโโ error.rs # Error handling
examples/
โโโ basic_usage.rs # Simple example
โโโ batch_convert.rs # Batch processing
๐ผ Commercial Use
This project is 100% commercial-friendly:
- โ Use in proprietary software
- โ Sell products containing this code
- โ No copyleft restrictions
- โ Modify and redistribute
- โ Patent protection (Apache-2.0)
Perfect for:
- Commercial applications
- SaaS products
- Enterprise software
- Consulting projects
- Proprietary systems
๐ License
Dual licensed under your choice of:
- MIT License - Simple and permissive
- Apache License 2.0 - Includes patent protection
See LICENSE-MIT and LICENSE-APACHE for details.
๐ค Author
topki
๐ง Email: 259901434@qq.com
๐ค Contributing
Contributions are welcome! This project is designed for easy contribution with:
- Clear module separation
- Comprehensive error handling
- Extensive test coverage
- Good documentation
๐ Links
Made with โค๏ธ by topki โข Commercial use permitted โข Production ready