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

  1. IDocumentRenderService (HTML Rendering) Parses Document, Section, and ContentBlock instances (using DocumentStyleJson, StyleJson, and LayoutJson) and merges them into a standardized HTML representation suitable for web browsers and headless PDF engines.

  2. 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 Aspire network loop.

  3. 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 the Document database 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 the Gotenberg microservice over HTTP.
  • IDocumentStorageService: Abstracts fundamental bucket operations (Put/Get/Delete) over S3 buckets using AWSSDK.S3 bindings or equivalent S3-client libraries.