|
1 | | -# 📄 Project Summary – PDF Report Generator with AI (Pdfy) |
| 1 | +# 📄 Docable – Turn Data into Documents Seamlessly |
2 | 2 |
|
3 | | -## 🎯 Project Goal: |
4 | | -Build a full-stack PDF Report Generator that accepts structured JSON input and returns a styled, downloadable PDF using dynamic templates. The system also uses AI (Groq + Mixtral) to intelligently enhance or complete missing data when necessary, making it smart and user-friendly. |
| 3 | +**Docable** is a powerful, minimal API service that transforms your structured JSON data into beautifully styled PDF documents using predefined templates. It's perfect for generating invoices, letters, and more — all through a simple POST request. |
5 | 4 |
|
6 | 5 | --- |
| 6 | +## ✨ Live Preview : https://docable.vercel.app/ |
7 | 7 |
|
8 | | -## 🧠 Core Functionalities |
| 8 | +- Input JSON in editor |
| 9 | +- Select template (Invoice / Letter) |
| 10 | +- Get instant PDF preview |
9 | 11 |
|
10 | | -- ✅ Accept JSON input (via API or form) |
11 | | -- ✅ Map data to Scriban template (e.g., letter, invoice, summary) |
12 | | -- ✅ Render HTML → PDF using DinkToPdf |
13 | | -- ✅ Return the final PDF to the user |
14 | | -- ✅ Use **Groq + Mixtral AI API** to auto-generate missing or enhanced content |
15 | | -- ✅ Supports multiple real-world use cases: |
16 | | - - Letter generator (resignation, visa, job offer) |
17 | | - - Invoice/report builder |
18 | | - - Summary PDF from raw inputs (future) |
| 12 | + |
| 13 | +## 🚀 Features |
| 14 | + |
| 15 | +- ⚡ Convert JSON to PDF instantly |
| 16 | +- 🧾 Built-in templates: Invoice, Letter |
| 17 | +- 🌐 REST API – easy to integrate |
| 18 | +- 🖥️ Live frontend for testing and preview |
| 19 | +- 🎨 Built with QuestPDF and React (Tailwind) |
19 | 20 |
|
20 | 21 | --- |
21 | 22 |
|
22 | | -## 🧪 Tech Stack |
| 23 | +## 📦 Tech Stack |
23 | 24 |
|
24 | | -### Backend |
25 | | -- ASP.NET Core Web API |
26 | | -- Scriban (template engine) |
27 | | -- DinkToPdf (HTML to PDF) |
28 | | -- HttpClient (AI calls) |
29 | | -- Optional: Docker, GitHub Actions, Render or Azure for deployment |
| 25 | +| Layer | Technology | |
| 26 | +|-----------|--------------------------| |
| 27 | +| Backend | ASP.NET Core Web API | |
| 28 | +| PDF Engine| QuestPDF | |
| 29 | +| Frontend | React + Tailwind CSS | |
| 30 | +| Templating| Scriban (for structure) | |
30 | 31 |
|
31 | | -### AI Integration |
32 | | -- **Groq API** (using Mixtral model) |
33 | | -- Use cases: |
34 | | - - Generate letter content from short prompts |
35 | | - - Fill missing fields in JSON |
36 | | - - Polish or rephrase input |
| 32 | +--- |
37 | 33 |
|
38 | | -### Frontend (Planned) |
39 | | -- React or Next.js |
40 | | -- TailwindCSS |
41 | | -- Simple UI to fill form, preview, and download PDF |
| 34 | +## 📬 API Usage |
42 | 35 |
|
43 | | ---- |
| 36 | +### Base URL |
44 | 37 |
|
45 | | -## 🧱 Architecture Flow |
| 38 | +``` |
| 39 | +https://docable.azurewebsites.net/api/pdf/generate/{template} |
| 40 | +``` |
46 | 41 |
|
47 | | -## JSON Input → Validate/Parse → [AI Fallback if needed] → Scriban Template → HTML → DinkToPdf → PDF Output |
| 42 | +### Supported Templates |
48 | 43 |
|
| 44 | +- `invoice` |
| 45 | +- `letter` |
49 | 46 |
|
50 | | ---- |
| 47 | +### Example Request (invoice) |
| 48 | + |
| 49 | +**POST** `/api/pdf/generate/invoice` |
| 50 | +Content-Type: `application/json` |
51 | 51 |
|
52 | | -## 🛠 Key Features To Build |
| 52 | +```json |
| 53 | +{ |
| 54 | + "companyName": "string", |
| 55 | + "invoiceNumber": "string", |
| 56 | + "...": "..." |
| 57 | +} |
| 58 | +``` |
53 | 59 |
|
54 | | -- `POST /generate-letter` endpoint |
55 | | -- Letter, invoice, summary templates (customizable) |
56 | | -- AI integration only when user input is incomplete or basic |
57 | | -- Optional features: |
58 | | - - API Key auth for SaaS model |
59 | | - - Rate limiting per user |
60 | | - - Frontend: Template preview & regenerate with AI |
| 60 | +### Response |
| 61 | + |
| 62 | +- Content-Type: `application/pdf` |
| 63 | +- Returns: PDF blob |
| 64 | + |
| 65 | +Example (JavaScript): |
| 66 | + |
| 67 | +```js |
| 68 | +const blob = await response.blob(); |
| 69 | +const url = URL.createObjectURL(blob); |
| 70 | +window.open(url); |
| 71 | +``` |
61 | 72 |
|
62 | 73 | --- |
63 | 74 |
|
64 | | -## 💡 Vision |
| 75 | +## 🖥️ Running Locally |
65 | 76 |
|
66 | | -> A lightweight, developer-friendly API and micro-SaaS tool that generates polished business documents from JSON input — enhanced by AI when needed. |
| 77 | +### Backend (.NET API) |
| 78 | + |
| 79 | +```bash |
| 80 | +dotnet restore |
| 81 | +dotnet run |
| 82 | +``` |
| 83 | +--- |
67 | 84 |
|
| 85 | +## 📖 Templates |
| 86 | + |
| 87 | +### 1. Invoice Template JSON |
| 88 | + |
| 89 | +```json |
| 90 | +{ |
| 91 | + "companyName": "string", |
| 92 | + "companyStreet": "string", |
| 93 | + "companyCityZip": "string", |
| 94 | + "companyPhone": "string", |
| 95 | + "companyFax": "string", |
| 96 | + "companyWebsite": "string", |
| 97 | + "invoiceDate": "string", |
| 98 | + "invoiceNumber": "string", |
| 99 | + "customerId": "string", |
| 100 | + "dueDate": "string", |
| 101 | + "clientName": "string", |
| 102 | + "clientCompany": "string", |
| 103 | + "clientStreet": "string", |
| 104 | + "clientCityZip": "string", |
| 105 | + "clientPhone": "string", |
| 106 | + "items": [ |
| 107 | + { |
| 108 | + "description": "string", |
| 109 | + "isTaxed": true, |
| 110 | + "amount": 0 |
| 111 | + } |
| 112 | + ], |
| 113 | + "subtotal": 0, |
| 114 | + "taxableAmount": 0, |
| 115 | + "taxRate": 0, |
| 116 | + "taxDue": 0, |
| 117 | + "otherCharges": 0, |
| 118 | + "total": 0, |
| 119 | + "otherComments": [ |
| 120 | + "string" |
| 121 | + ], |
| 122 | + "contactInfo": "string" |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +### 2. Letter Template JSON |
| 127 | + |
| 128 | +```json |
| 129 | +{ |
| 130 | + "senderName": "string", |
| 131 | + "senderTitle": "string", |
| 132 | + "senderCompany": "string", |
| 133 | + "senderAddress": "string", |
| 134 | + "recipientName": "string", |
| 135 | + "recipientTitle": "string", |
| 136 | + "recipientCompany": "string", |
| 137 | + "recipientAddress": "string", |
| 138 | + "date": "string", |
| 139 | + "subject": "string", |
| 140 | + "body": "string", |
| 141 | + "closing": "string", |
| 142 | + "signatureName": "string", |
| 143 | + "signatureTitle": "string" |
| 144 | +} |
| 145 | +``` |
| 146 | + |
| 147 | + |
| 148 | +## 📝 License |
| 149 | + |
| 150 | +MIT © 2025 Mutashim / Docable |
0 commit comments