# ppt2img-converter **Repository Path**: widercode_admin/ppt2img-converter ## Basic Information - **Project Name**: ppt2img-converter - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-17 - **Last Updated**: 2025-10-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PPT转图片服务 [![Python](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://python.org) [![Flask](https://img.shields.io/badge/Flask-2.3%2B-green.svg)](https://flask.palletsprojects.com/) [![Docker](https://img.shields.io/badge/Docker-Ready-blue.svg)](https://docker.com) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) 专业的PPT转图片服务,支持Linux服务器部署,提供RESTful API接口和命令行工具。 ## ✨ 特性 - 🚀 **高性能**: 基于LibreOffice引擎,支持无头服务器运行 - 🌐 **RESTful API**: 标准HTTP接口,支持异步转换 - 🐳 **容器化**: 支持Docker和Docker Compose部署 - 📊 **多格式支持**: PNG、JPEG输出格式 - 🔧 **易部署**: 一键安装脚本,systemd服务管理 - 📝 **完整文档**: 详细的部署和使用指南 ## 🚀 快速开始 ### 命令行工具 ```bash # 转换单个文件 python main.py convert presentation.pptx -o ./output # 启动API服务器 python main.py server --port 5000 ``` ### API接口 ```bash # 转换PPT curl -X POST \ -F "file=@presentation.pptx" \ -F "format=png" \ http://localhost:5000/api/v1/convert ``` ### Docker部署 ```bash # 构建并启动 docker-compose -f deploy/docker/docker-compose.yml up -d ``` ## 📁 项目结构 ``` ppt-converter/ ├── main.py # 主入口文件 ├── requirements.txt # Python依赖 ├── src/ # 源代码 │ ├── __init__.py │ ├── core/ # 核心转换模块 │ │ ├── __init__.py │ │ └── converter.py │ ├── api/ # API服务模块 │ │ ├── __init__.py │ │ └── server.py │ └── utils/ # 工具模块 │ ├── __init__.py │ ├── config.py │ └── logger.py ├── config/ # 配置文件 │ ├── default.yml │ └── production.yml ├── deploy/ # 部署文件 │ ├── docker/ # Docker部署 │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ └── docker-entrypoint.sh │ ├── systemd/ # systemd服务 │ │ └── ppt-converter.service │ └── scripts/ # 安装脚本 │ └── install_server.sh ├── docs/ # 文档 │ ├── README.md │ ├── QUICKSTART.md │ └── SERVER_DEPLOYMENT.md ├── tests/ # 测试文件 ├── examples/ # 示例文件 ├── webapp/ # 前端Web应用(Next.js) │ ├── app/ # 应用入口与页面 │ ├── components/ # 组件 │ ├── public/ # 静态资源 │ ├── package.json │ └── README.md ├── logs/ # 日志目录 └── data/ # 数据目录 ├── uploads/ ├── outputs/ └── temp/ ``` ## 📖 文档 - [快速开始指南](docs/QUICKSTART.md) - [服务器部署指南](docs/SERVER_DEPLOYMENT.md) - [API接口文档](docs/API.md) - [配置说明](docs/CONFIGURATION.md) ## 🔧 安装 ### 系统要求 - Python 3.8+ - LibreOffice - Linux/macOS/Windows ### 自动安装(Linux) ```bash # 下载并运行安装脚本 sudo ./deploy/scripts/install_server.sh ``` ### 手动安装 ```bash # 1. 安装Python依赖 pip install -r requirements.txt # 2. 安装LibreOffice # Ubuntu/Debian sudo apt-get install libreoffice # CentOS/RHEL sudo yum install libreoffice # 3. 启动服务 python main.py server ``` ## 🐳 Docker部署 ```bash # 构建镜像 docker build -f deploy/docker/Dockerfile -t ppt-converter . # 运行容器 docker run -d -p 5000:5000 ppt-converter # 或使用docker-compose cd deploy/docker docker-compose up -d ``` ## 📡 API使用 ### 健康检查 ```http GET /api/v1/health ``` ### 转换PPT ```http POST /api/v1/convert Content-Type: multipart/form-data file: presentation.pptx format: png ``` ### 获取任务状态 ```http GET /api/v1/status/{task_id} ``` ### 下载结果 ```http GET /api/v1/download/{task_id} ``` ## ⚙️ 配置 配置文件位置(优先级从高到低): 1. `/etc/ppt-converter/config.yml` 2. `~/.ppt-converter/config.yml` 3. `config/production.yml` 4. `config/default.yml` 环境变量: ```bash export PORT=5000 export HOST=0.0.0.0 export TEMP_DIR=/tmp/ppt_converter export UPLOAD_DIR=/tmp/ppt_uploads export OUTPUT_DIR=/tmp/ppt_outputs ``` ## 🧪 测试 ```bash # 运行所有测试 python main.py test # 或使用pytest pytest tests/ ``` ## 📝 开发 ### 开发环境设置 ```bash # 1. 克隆项目 git clone cd ppt-converter # 2. 创建虚拟环境 python -m venv venv source venv/bin/activate # Linux/macOS # venv\Scripts\activate # Windows # 3. 安装依赖 pip install -r requirements.txt # 4. 启动开发服务器 python main.py server --debug ``` ### 代码结构 - `src/core/`: 核心转换逻辑 - `src/api/`: API服务器 - `src/utils/`: 工具模块 - `tests/`: 单元测试 - `config/`: 配置文件 ## 🤝 贡献 欢迎提交Issue和Pull Request! 1. Fork 项目 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) 4. 推送到分支 (`git push origin feature/AmazingFeature`) 5. 打开Pull Request ## 📄 许可证 本项目采用MIT许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。 ## 🙏 致谢 - [LibreOffice](https://www.libreoffice.org/) - 强大的办公套件 - [Flask](https://flask.palletsprojects.com/) - 轻量级Web框架 - [python-pptx](https://python-pptx.readthedocs.io/) - PowerPoint处理库 ## 📞 支持 如果遇到问题,请: 1. 查看[文档](docs/) 2. 搜索[Issues](../../issues) 3. 创建新的[Issue](../../issues/new) --- Made with ❤️ for the open source community