| Crates.io | pdf-converter |
| lib.rs | pdf-converter |
| version | 0.1.0 |
| created_at | 2025-06-22 01:31:23.625934+00 |
| updated_at | 2025-06-22 01:31:23.625934+00 |
| description | A simple and efficient library for converting images (JPG, PNG, GIF, BMP, WebP) to PDF documents. Commercial use permitted under MIT/Apache-2.0 license. |
| homepage | https://github.com/topki/pdf-converter |
| repository | https://github.com/topki/pdf-converter |
| max_upload_size | |
| id | 1721221 |
| size | 95,148 |
A simple and efficient Rust library for converting images to PDF documents with support for multiple formats and commercial use.
Add to your Cargo.toml:
[dependencies]
pdf-converter = "0.1.0"
use pdf_converter::PdfConverter;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let converter = PdfConverter::new();
// Convert a single image
converter.convert_image_to_pdf("image.jpg", "output.pdf")?;
// Convert entire folder to single PDF
converter.convert_folder_to_pdf("images/", "batch_output.pdf")?;
Ok(())
}
use pdf_converter::{PdfConverter, PdfConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = PdfConfig {
dpi: 300.0,
margin_mm: 20.0,
title: Some("My Document".to_string()),
};
let converter = PdfConverter::with_config(config);
converter.convert_folder_to_pdf("images/", "high_quality.pdf")?;
Ok(())
}
Run the comprehensive test suite:
cargo run --bin comprehensive_test
Or quick validation:
cargo run --bin quick_test
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
This project is 100% commercial-friendly:
Perfect for:
Dual licensed under your choice of:
See LICENSE-MIT and LICENSE-APACHE for details.
topki
๐ง Email: 259901434@qq.com
Contributions are welcome! This project is designed for easy contribution with:
Made with โค๏ธ by topki โข Commercial use permitted โข Production ready