Rendering and Export Integration
MILTON utilizes a set of infrastructure providers to transform internal Document structures into presentable UI structures and rendered PDFs, alongside scalable S3-compatible cloud storage.
Architectural Flow
-
IDocumentRenderService(HTML Rendering) ParsesDocument,Section, andContentBlockinstances (usingDocumentStyleJson,StyleJson, andLayoutJson) and merges them into a standardized HTML representation suitable for web browsers and headless PDF engines. -
IPdfGenerationService(PDF Conversion via Gotenberg) Takes the rendered HTML payload (often accompanied by CSS styles or Markdown outputs) and pipes it to a lightweight sidecar container using Gotenberg. Gotenberg operates as a stateless HTTP-based headless execution layer, providing consistent, highly scalable PDF rendering capabilities within the.NET Aspirenetwork loop. -
IDocumentStorageService(S3 Storage via RustFS/MinIO) After a PDF is created, it is archived into an S3-compatible object storage service. The target key (PdfStorageKey) and timestamp (PdfGeneratedAt) are tracked back onto theDocumentdatabase entity. This allows subsequent retrieval calls to point securely to the external blob storage.
Configuration & Setup
Gotenberg API
Handled through Aspire automatically via AppHost.cs. It expects a mapped Docker endpoint passing execution variables towards the underlying C# API (services__gotenberg__http__0).
S3 / RustFS
Managed globally as an S3 compatible persistence layer. It requires setting up the bucket naming, Endpoint URL, Access key, and Secret Key inside the development or prod vault instance.
Service Interfaces
IDocumentRenderService: Synchronously converts native document blocks to presentation HTML.IPdfGenerationService: Communicates with theGotenbergmicroservice over HTTP.IDocumentStorageService: Abstracts fundamental bucket operations (Put/Get/Delete) over S3 buckets usingAWSSDK.S3bindings or equivalent S3-client libraries.