LogiMinder Timesheet PDF is a lightweight Node.js API for generating professional timesheet PDFs from structured JSON data. It supports multiple languages, strict schema validation, and customizable layouts.
- ✨ Key Features
- 🛠️ Prerequisites
- 📋 Getting Started
- 📡 API Usage
- 📄 PDF Structure
- 🤝 Contributing
- 👥 Contributors
- 📜 License
- 📄 Dynamic PDF Generation: Creates professional timesheet PDFs with consultant info, client details, daily time tracking, and validation sections.
- 🌍 Multilingual Support: Supports English (
en
), French (fr
), Spanish (es
), Portuguese (pt
), German (de
), Italian (it
), and Arabic (ar
). - 🧪 Strict JSON Validation: Uses AJV to enforce a robust schema for consistent input data.
- 🖼️ Customizable Logo: Supports base64-encoded images (JPEG, PNG, GIF) for branding.
- 📊 Time Tracking: Tracks mission, leaves, sick leave, and other activities with daily and total summaries.
- 🐳 Docker Support: Easy deployment with Docker and Docker Compose.
- 🎨 Styled Layout: Color-coded headers, weekends, and totals for improved readability.
- Node.js (v16 or newer) for local development.
- Docker (optional) for containerized deployment.
- Fonts: Ensure
Roboto
andAmiri
fonts are available in thefonts/
directory (included in the repository). - Git to clone the repository.
git clone https://github.com/drslid/LogiMinder_Timesheet_PDF.git
cd LogiMinder_Timesheet_PDF
npm install
node server.js
The API will be available at http://localhost:3000
.
-
Build the Docker image:
docker build -t logiminder-timesheet .
-
Run the container:
docker run -p 3000:3000 logiminder-timesheet
-
Access the API at
http://localhost:3000
.
docker-compose up --build
The API will be available at http://localhost:3000
.
- Method:
POST /generate-pdf
- Content-Type:
application/json
- Response: Binary PDF file (
application/pdf
)
The API expects a JSON payload with the following structure:
{
"language": "string",
"callData": {
"logo": "string",
"date": "string",
"consultant": {
"name": "string",
"firstName": "string",
"email": "string",
"phone": "string",
"identifier": "string"
},
"client": "string",
"mission": "string",
"table": {
"mission": ["string"],
"leaves": ["string"],
"sickLeave": ["string"],
"others": ["string"]
},
"comments": "string",
"validations": {
"employee": {
"name": "string",
"validationDate": "string",
"method": "string",
"token": "string"
},
"approver": {
"name": "string",
"validationDate": "string",
"method": "string",
"token": "string"
}
}
}
}
curl -X POST http://localhost:3000/generate-pdf \
-H "Content-Type: application/json" \
-d '{
"language": "en",
"callData": {
"logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAIAAAC1nk4lAAAAgElEQVR4nOzQMQ3CYBhFUUJ+AyjABgMzCwsWEFhdXSuhKr6bNDlHwMvNW5/3/TbjeP2HlqeKR4muiK6IroiuiK6IroiuiK6IroiuiK6IroiuiK6s7/4Ymv49t6HlSz4tuiK6IroiuiK6IroiuiK6IroiuiK6IroiuiK6cgYAAP//ImUE6VlfCnoAAAAASUVORK5CYII=",
"date": "05/2025",
"consultant": {
"name": "Smith",
"firstName": "Alex",
"email": "alex.smith@example.com",
"phone": "+15551234567",
"identifier": "12365465465445"
},
"client": "Acme Industries",
"mission": "Full-Stack Dev",
"table": {
"mission": ["2:0"],
"leaves": ["2:1"],
"sickLeave": [],
"others": []
},
"comments": "Project on track.",
"validations": {
"employee": {
"name": "Alex Smith",
"validationDate": "2025-05-31",
"method": "Email",
"token": "123456"
},
"approver": {
"name": "Jordan Lee",
"validationDate": "2025-05-31",
"method": "Email",
"token": "654321"
}
}
}
}' > timesheet.pdf
language
: Must be one ofen
,fr
,es
,pt
,de
,it
,ar
.logo
: Base64-encoded image (JPEG, PNG, or GIF). Use tools like Base64-Image to convert images.date
: FormatMM/YYYY
(e.g.,05/2025
).consultant
: Required fields:name
,firstName
,email
. Optional:phone
,identifier
.client
: Client name (max 100 characters).mission
: Project or mission name (max 100 characters).table
: Arrays of day pointers in formatDAY:VALUE
(e.g.,2:0.5
):mission
: Values0
,0.5
,1
.leaves
,sickLeave
,others
: Values0.5
,1
.
comments
: Optional comments (max 1000 characters).validations
: Employee and approver details, includingname
,validationDate
(YYYY-MM-DD),method
(Email, SMS, Other), andtoken
.
The API uses AJV to validate incoming JSON against a schema (schema.js
). Invalid payloads return a 400
error with detailed validation errors, ensuring consistent PDF output.
The generated PDF includes:
- Header: Logo (top-left), title with month and year (center).
- Consultant Info: Name, first name, email, phone, identifier (left).
- Client Info: Client name, mission (right).
- Table: Displays days of the month, with rows for mission, leaves, sick leave, others, and daily totals. Weekends are highlighted.
- Comments: Optional section with user-provided comments.
- Validation: Employee and approver details (name, date, method, token).
- Footer: "LogiMinder" branding.
Contributions are welcome! Here's how you can help:
- Report Issues: Open an issue for bugs or suggestions.
- Submit Pull Requests:
- Fork the repository.
- Create a branch:
git checkout -b feature/your-feature
. - Commit changes:
git commit -m "Add your feature"
. - Push to your fork:
git push origin feature/your-feature
. - Open a pull request.
This project is licensed under the MIT License.
Build to automate timesheets. Generate clean, multilingual reports. 📄🌍🚀