A .NET 8.0 web application for generating PDF documents from HTML templates using PuppeteerSharp and Razor templating engine.
- .NET 8.0 SDK
- Google Chrome browser
- Git
# 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 runThe application will be available at http://localhost:5000
- Setup Guide - First-time setup instructions
- PDF Generation Guide - Complete PDF generation workflow
- Program Configuration - Application startup and configuration
- Controllers - API endpoints and request handling
- Services - Business logic and service implementations
- Models - Data models and enums
- Templates - HTML template structure and styling
- Developer Guide - Advanced development information
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
- 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
POST /api/v1/pdf
Content-Type: application/json
{
"templateType": "TemplateA",
"voucherType": "Invoice",
"theme": { ... },
"data": { ... }
}- Swagger UI:
http://localhost:5000/swagger - OpenAPI specification available
- .NET 8.0 - Web framework
- PuppeteerSharp - Chrome automation for PDF generation
- RazorLight - Template engine
- Serilog - Structured logging
- Swashbuckle - API documentation
<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" />- Setup: Follow the Setup Guide for initial installation
- Configuration: Configure Chrome path in
Services/PdfService.csfor local development - Testing: Use the PDF Generation Guide to test PDF creation
- Development: Refer to architecture documentation for code understanding
- Standard invoice and document templates
- Support for various voucher types (Invoice, Receipt, Payment, etc.)
- Customizable headers, footers, and body sections
- Tally ERP integration templates
- Specialized formatting for Tally data structures
- Thermal printer optimized templates
- Compact layout for receipt printing
- Font Families: Inter, Open Sans, Lato, Roboto
- Dynamic Sizing: Configurable font sizes
- Color Schemes: Primary and secondary color theming
- Margins: Customizable page margins
Common issues and solutions are documented in:
- Chrome executable path must be configured for local development
- Application restart required after code changes (
dotnet run) - Generated PDFs are saved to
/Downloadsdirectory - Debug mode available via
debugMode=truequery parameter
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is part of the Walkover Web Solution ecosystem.
- 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.