Data.PdfGen
Version 1 · Document the Data.PdfGen MVC + API app for racing PDF generation
Data.PdfGen
An ASP.NET Core MVC + API application that generates racing PDFs — review PDFs and final-report / form PDFs — from the rs MySQL database using iText7.
SDK: Microsoft.NET.Sdk.Web. Key packages: itext7 8.0.5, itext7.bouncy-castle-adapter 8.0.5, MySqlConnector 2.3.7.
Startup
Program.cs registers the code-pages encoding provider, AddControllersWithViews, static files, and the scoped services DbService, MeetingDataService, ReviewPdfService, FinalReportPdfService. Routing uses the default MVC route {controller=Home}/{action=Index}/{id?} plus attribute-routed API controllers.
Endpoints
HomeController(MVC) —Index,Privacy,Error.ReviewController(MVC) —Index(...)renders a review view viaMeetingDataService.PdfController(API,[Route("api/[controller]")]):GET /api/Pdf/review?meetingId&date&discipline=TGET /api/Pdf/finalreport?date&discipline=TGET /api/Pdf/download?path=
Services
DbService— raw SQL viaMySqlConnector(QueryAsync/ExecuteAsync/ScalarAsync).MeetingDataService— queriesrs.tblprerace_*,tblrsratings, and horse forms.ReviewPdfService/FinalReportPdfService— build PDFs with iTextPdfDocument; injectIWebHostEnvironmentandIConfiguration.PdfHelper— static text / formatting / time helpers (AutoSizeCell, etc.).
Views and resources
Razor views live under Views/ (Home, Review, and shared layout / error partials). The resources/ folder holds fonts (Arial, Arial Narrow, Courier, Lato) and logos / icons used in the PDFs; sample output PDFs are under data/pdf/reviewPDF/.
Configuration
appsettings.json defines ConnectionStrings:RS (the rs database) and a PdfGen section with OutputPath (data/pdf) and ResourcesPath (resources).
The
RSconnection string is a live credential committed in source — treat it as a secret.