{"id":49109370,"url":"https://github.com/djav1985/v-gpt-pdf-generator","last_synced_at":"2026-04-21T03:34:22.501Z","repository":{"id":247724169,"uuid":"824745313","full_name":"djav1985/v-gpt-pdf-generator","owner":"djav1985","description":"The v-gpt-pdf-generator is an efficient, FastAPI-based web service designed to convert HTML and CSS content into high-quality PDFs. By leveraging WeasyPrint for PDF generation, it facilitates asynchronous operations using Aiohttp and Aiofiles, ensuring fast and scalable performance. The application is containerized for ease of deployment.","archived":false,"fork":false,"pushed_at":"2025-09-19T22:41:53.000Z","size":4840,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T00:57:19.462Z","etag":null,"topics":["ai","api","chatgpt","dify","docker","fastapi","flowise","flowise-ai","gpt","openai","openapi","pdf","pdf-generation","python","weasyprint"],"latest_commit_sha":null,"homepage":"https://vontainment.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djav1985.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-07-05T20:55:34.000Z","updated_at":"2025-09-19T22:41:53.000Z","dependencies_parsed_at":"2025-09-10T00:17:06.198Z","dependency_job_id":"b25efb5a-6b36-4cc1-b421-eb1332164937","html_url":"https://github.com/djav1985/v-gpt-pdf-generator","commit_stats":null,"previous_names":["djav1985/v-gpt-pdf-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/djav1985/v-gpt-pdf-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djav1985%2Fv-gpt-pdf-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djav1985%2Fv-gpt-pdf-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djav1985%2Fv-gpt-pdf-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djav1985%2Fv-gpt-pdf-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djav1985","download_url":"https://codeload.github.com/djav1985/v-gpt-pdf-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djav1985%2Fv-gpt-pdf-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32075255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","chatgpt","dify","docker","fastapi","flowise","flowise-ai","gpt","openai","openapi","pdf","pdf-generation","python","weasyprint"],"created_at":"2026-04-21T03:34:21.884Z","updated_at":"2026-04-21T03:34:22.484Z","avatar_url":"https://github.com/djav1985.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"v-gpt-pdf-generator.png\" width=\"60%\" alt=\"project-logo\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ch1 align=\"center\"\u003e\u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eTransform Ideas into PDFs, Effortlessly!\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003c!-- local repository, no metadata badges. --\u003e\n\u003cp\u003e\n\u003cp align=\"center\"\u003e\n\t\t\u003cem\u003eDeveloped with the software and tools below.\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Pydantic-E92063.svg?style=flat-square\u0026logo=Pydantic\u0026logoColor=white\" alt=\"Pydantic\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/YAML-CB171E.svg?style=flat-square\u0026logo=YAML\u0026logoColor=white\" alt=\"YAML\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Python-3776AB.svg?style=flat-square\u0026logo=Python\u0026logoColor=white\" alt=\"Python\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/AIOHTTP-2C5BB4.svg?style=flat-square\u0026logo=AIOHTTP\u0026logoColor=white\" alt=\"AIOHTTP\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Docker-2496ED.svg?style=flat-square\u0026logo=Docker\u0026logoColor=white\" alt=\"Docker\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/FastAPI-009688.svg?style=flat-square\u0026logo=FastAPI\u0026logoColor=white\" alt=\"FastAPI\"\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\u003cbr\u003e\n\n- [📍 Overview](#-overview)\n- [🧩 Features](#-features)\n- [🗂️ Repository Structure](#️-repository-structure)\n- [📦 Modules](#-modules)\n- [🚀 Getting Started](#-getting-started)\n  - [⚙️ Installation](#️-installation)\n  - [🤖 Usage](#-usage)\n- [🛠 Project Changelog](#-project-changelog)\n- [🎗 License](#-license)\n\u003c/details\u003e\n\u003chr\u003e\n\n## 📍 Overview\n\nThe project is a robust PDF Generation API built on FastAPI, designed to streamline the creation of PDF documents from HTML content. It offers a user-friendly interface that allows users to submit requests and generate customized PDFs while ensuring secure access through API key validation. By leveraging containerization with Docker, the application ensures seamless deployment and operation, facilitating efficient scaling and management. The value proposition lies in its ability to provide high-quality, customizable document generation capabilities, making it an essential tool for developers needing to integrate PDF functionalities into their applications while maintaining a clean and organized codebase.\n\n---\n\n## 🧩 Features\n\n|    |   Feature         | Description |\n|----|-------------------|---------------------------------------------------------------|\n| ⚙️  | **Architecture**  | A microservice architecture utilizing FastAPI for web services and asynchronous capabilities. Docker containers orchestrate the PDF generation service, enhancing deployment and scalability. |\n| 🔩 | **Code Quality**  | The codebase follows PEP 8 style guidelines with clear variable names, modular functions, and consistent formatting. It emphasizes clean code practices, improving readability and maintainability. |\n| 📄 | **Documentation** | Documentation is comprehensive, detailing setup with `requirements.txt`, `Dockerfile`, and `docker-compose.yml`. In-line comments and structured organization guide users through the core functionalities. |\n| 🔌 | **Integrations**  | Essential integrations include FastAPI for building APIs and WeasyPrint for PDF generation. These components facilitate seamless data handling and PDF services. |\n| 🧩 | **Modularity**    | The codebase is highly modular, with separate files for routing, models, and dependencies. This structure promotes reusability and easier testing, allowing developers to update components independently. |\n| 🧪 | **Testing**       | Automated test suite covers PDF generation, request validation, authentication, cleanup, and routes. |\n| ⚡️  | **Performance**   | Optimized for high efficiency, the application handles multiple requests concurrently with FastAPI, minimizing response times and resource usage through asynchronous programming. |\n| 🛡️ | **Security**      | Employs API key validation and secure access measures. Techniques like input validation and error handling safeguard against common vulnerabilities during PDF generation. |\n| 📦 | **Dependencies**  | Key dependencies include FastAPI, WeasyPrint, Pydantic for data validation, aiofiles for file handling, and uvicorn for running the application, ensuring robust functionality and performance. |\n| 🚀 | **Scalability**   | Designed to scale effectively with containerization using Docker. FastAPI enables asynchronous processing, allowing the application to manage increased loads and user requests without degradation of performance. |\n\n---\n\n## 🗂️ Repository Structure\n\n```sh\n└── /\n    ├── Dockerfile\n    ├── README.md\n    ├── app\n    │   ├── __init__.py\n    │   ├── dependencies.py\n    │   ├── main.py\n    │   ├── models.py\n    │   └── routes\n    │       ├── __init__.py\n    │       └── create.py\n    ├── docker-compose.yml\n    ├── requirements.txt\n    └── v-gpt-pdf-generator.png\n```\n\n---\n\n## 📦 Modules\n\n\u003cdetails closed\u003e\u003csummary\u003e.\u003c/summary\u003e\n\n| File                                     | Summary                                                                                                                                                                                                                                                                                                                                                                         |\n| ---                                      | ---                                                                                                                                                                                                                                                                                                                                                                             |\n| [requirements.txt](requirements.txt)     | Defines essential dependencies for the application, ensuring compatibility and functionality of key libraries. By incorporating FastAPI, WeasyPrint, and other critical packages, it enables robust web service capabilities, document generation, and efficient data handling, aligning seamlessly with the repositorys architecture to support the overall application goals. |\n| [docker-compose.yml](docker-compose.yml) | Facilitates the orchestration of a PDF generation service within the repositorys architecture by defining the containerized environment. It configures essential parameters such as network settings, environment variables, and persistent storage, ensuring seamless integration and operation of the PDF generation application.                                             |\n| [Dockerfile](Dockerfile)                 | Facilitates the creation and deployment of a FastAPI application by establishing a multi-stage Docker environment. It efficiently manages Python dependencies, integrates necessary system libraries for rendering, and configures runtime parameters while ensuring the application is accessible on port 8888, aligning with the overall architecture of the repository.      |\n\n\u003c/details\u003e\n\n\u003cdetails closed\u003e\u003csummary\u003eapp\u003c/summary\u003e\n\n| File                                   | Summary                                                                                                                                                                                                                                                                                                                                             |\n| ---                                    | ---                                                                                                                                                                                                                                                                                                                                                 |\n| [main.py](app/main.py)                 | Facilitates the core functionality of the PDF Generation API by establishing a FastAPI application, integrating routing for PDF creation, and serving generated PDFs through a dedicated static files directory. This setup enhances the repositorys architecture by providing a scalable and organized approach to handle PDF generation requests. |\n| [dependencies.py](app/dependencies.py) | Facilitates asynchronous PDF generation and cleanup tasks within the repository. It crafts customized HTML templates from content and CSS, integrates code highlighting, and manages a downloads folder by removing outdated files. Additionally, it ensures API key validation for secure access to the application.                               |\n| [models.py](app/models.py)             | Defines a data model for generating PDFs, ensuring structured input through required fields like title and body content, while allowing optional custom styling and filenames. This model seamlessly integrates with the applications architecture to facilitate user-friendly PDF creation from HTML content, enhancing overall functionality.     |\n\n\u003c/details\u003e\n\n\u003cdetails closed\u003e\u003csummary\u003eapp.routes\u003c/summary\u003e\n\n| File                              | Summary                                                                                                                                                                                                                                                                                                                                                        |\n| ---                               | ---                                                                                                                                                                                                                                                                                                                                                            |\n| [create.py](app/routes/create.py) | Facilitates PDF generation by processing user requests and producing downloadable files. It ensures unique filename creation, integrates API key verification, and handles exceptions gracefully, enhancing the overall functionality of the application by linking user inputs with the PDF creation process effectively within the repositorys architecture. |\n\n\u003c/details\u003e\n\n---\n\n## 🚀 Getting Started\n\n**System Requirements:**\n\n* **Python**: `version 3.10`\n\n\n### ⚙️ Installation\n\n1. **Download the `docker-compose.yml` file**:  \n   Save the provided `docker-compose.yml` file to your project directory.\n\n2. **Edit Environment Variables**:\n   The application reads `BASE_URL`, `ROOT_PATH`, and `API_KEY` using a Pydantic\n   `Settings` model located in `app/config.py`. These values can be supplied via\n   environment variables or a `.env` file. Open the `docker-compose.yml` file and\n   set the environment variables according to your setup:\n\n   ```yaml\n   environment:\n      BASE_URL: https://api.servicesbyv.com # Set this to your actual base URL\n      ROOT_PATH: /pdf\n      API_KEY: # Optional API key to connect to the API\n      WORKERS: 1  # Number of Uvicorn workers; 1 is usually enough for personal use\n      UVICORN_CONCURRENCY: 32  # Max connections; anything over this number is rejected\n   ```\n\n3. **Run the Docker Compose**:  \n   Use the following command to start the service:\n\n   ```bash\n   docker-compose up\n   ```\n\n4. **(Optional) Run in Detached Mode**:  \n   To run the containers in the background, use:\n\n   ```bash\n   docker-compose up -d\n   ```\n\n### 🤖 Usage\n\n#### From `docker-compose`\n\n1. **Access the OpenAPI Specifications**:  \n   To get the OpenAPI specifications and integrate with your AI tool, navigate to:\n\n   ```\n   BASE_URL/openapi.json\n   ```\n\n    Replace `BASE_URL` with the actual URL of your application (e.g., `https://api.servicesbyv.com/pdf/openapi.json`).\n   A generated copy of this specification is available in `openapi.json` at the project root.\n\n2. **Generate a PDF**:\n   Send a POST request to the root endpoint with a JSON body:\n\n   ```bash\n   curl -X POST \"$BASE_URL/\" \\\\\n     -H \"Content-Type: application/json\" \\\\\n     -H \"X-API-Key: $API_KEY\" \\\\ # optional\n     -d '{\n       \"pdf_title\": \"Example\",\n       \"body_content\": \"\u003cp\u003eHello\u003c/p\u003e\",\n       \"contains_code\": false,\n       \"css_content\": \"p { color: blue; }\",\n       \"output_filename\": \"example\"\n     }'\n   ```\n\n   The response includes a `url` to download the generated PDF from `/downloads`.\n   If `BASE_URL` is not set, this will be a relative path.\n---\n\n## 🛠 Project Changelog\n\n-  `► Added better default CSS`\n-  `► Added title parameter to set the H1 header`\n-  `► Added contains_code parameter to allow formatted code blocks`\n-  `► Added output_filename parameter for custom file names`\n\n---\n\n## 🎗 License\n\nThis project is protected under the MIT Licence\n\n---\n\n[**Return**](#-overview)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjav1985%2Fv-gpt-pdf-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjav1985%2Fv-gpt-pdf-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjav1985%2Fv-gpt-pdf-generator/lists"}