Skip to content

Walkover-Web-Solution/GIDDH_UI_Sharp

Repository files navigation

GiddhTemplate - PDF Generation Service

A .NET 8.0 web application for generating PDF documents from HTML templates using PuppeteerSharp and Razor templating engine.

πŸš€ Quick Start

Prerequisites

  • .NET 8.0 SDK
  • Google Chrome browser
  • Git

Installation

# Clone the repository
git clone https://github.com/Walkover-Web-Solution/GIDDH_UI_Sharp
cd GIDDH_UI_Sharp

# Restore dependencies
dotnet restore

# Run the application
dotnet run

The application will be available at http://localhost:5000

πŸ“š Documentation

Getting Started

Architecture Documentation

Developer Resources

πŸ—οΈ Project Structure

GiddhTemplate/
β”œβ”€β”€ Controllers/           # API controllers
β”œβ”€β”€ Models/               # Data models and enums
β”œβ”€β”€ Services/             # Business logic services
β”œβ”€β”€ Templates/            # HTML templates and fonts
β”‚   β”œβ”€β”€ Fonts/           # Font files for PDF generation
β”‚   β”œβ”€β”€ Tally/           # Tally template files
β”‚   β”œβ”€β”€ TemplateA/       # Default template files
β”‚   └── Thermal/         # Thermal printer template files
β”œβ”€β”€ docs/                # Documentation files
└── sample-payloads/     # Sample JSON payloads for testing

πŸ”§ Key Features

  • PDF Generation: Convert HTML templates to PDF using Chrome headless browser
  • Multiple Templates: Support for Tally, TemplateA, and Thermal templates
  • Font Management: Dynamic font loading and CSS generation
  • Razor Templating: Server-side HTML generation with Razor syntax
  • RESTful API: Simple HTTP API for PDF generation

πŸ“‹ API Endpoints

PDF Generation

POST /api/v1/pdf
Content-Type: application/json

{
  "templateType": "TemplateA",
  "voucherType": "Invoice",
  "theme": { ... },
  "data": { ... }
}

API Documentation

  • Swagger UI: http://localhost:5000/swagger
  • OpenAPI specification available

πŸ› οΈ Technology Stack

  • .NET 8.0 - Web framework
  • PuppeteerSharp - Chrome automation for PDF generation
  • RazorLight - Template engine
  • Serilog - Structured logging
  • Swashbuckle - API documentation

πŸ“¦ Dependencies

<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.11" />
<PackageReference Include="PuppeteerSharp" Version="20.1.1" />
<PackageReference Include="RazorLight" Version="2.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />

🚦 Getting Started Workflow

  1. Setup: Follow the Setup Guide for initial installation
  2. Configuration: Configure Chrome path in Services/PdfService.cs for local development
  3. Testing: Use the PDF Generation Guide to test PDF creation
  4. Development: Refer to architecture documentation for code understanding

πŸ” Template Types

TemplateA (Default)

  • Standard invoice and document templates
  • Support for various voucher types (Invoice, Receipt, Payment, etc.)
  • Customizable headers, footers, and body sections

Tally

  • Tally ERP integration templates
  • Specialized formatting for Tally data structures

Thermal

  • Thermal printer optimized templates
  • Compact layout for receipt printing

🎨 Theming Support

  • Font Families: Inter, Open Sans, Lato, Roboto
  • Dynamic Sizing: Configurable font sizes
  • Color Schemes: Primary and secondary color theming
  • Margins: Customizable page margins

πŸ› Troubleshooting

Common issues and solutions are documented in:

πŸ“ Development Notes

  • Chrome executable path must be configured for local development
  • Application restart required after code changes (dotnet run)
  • Generated PDFs are saved to /Downloads directory
  • Debug mode available via debugMode=true query parameter

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is part of the Walkover Web Solution ecosystem.

πŸ”— Related Projects

  • GIDDH: Main accounting application
  • Walkover Web Solution: Parent organization

For detailed information on any component, refer to the specific documentation files in the docs/ directory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7