GhaylStackDocumentationv1.0.2
العربيةWebsite
Operations

Operations

PDF rendering and Chromium

Install the correct .NET Playwright browser and choose local or private-worker printing.

Understand the rendering path

Reports and invoices use HTML rendered by Chromium through Microsoft.Playwright. Billing delegates to the shared HTML-to-PDF contract. The browser process is reused, while requests receive separate rendering contexts. The source explicitly enables the Chromium sandbox.

Local rendering is the default when both worker settings are absent. Installing a system Chrome or visiting the Chromium website does not install the driver-matched browser required by this application. Use the installer produced by the built .NET project.

Install the matching browser

From a source checkout:

sh
dotnet build src/Host/GhaylStack.Api -c Release
pwsh src/Host/GhaylStack.Api/bin/Release/net11.0/playwright.ps1 install chromium

On Linux, provision OS dependencies with appropriate system privileges, then install the browser for the runtime account:

sh
pwsh src/Host/GhaylStack.Api/bin/Release/net11.0/playwright.ps1 install-deps chromium
pwsh src/Host/GhaylStack.Api/bin/Release/net11.0/playwright.ps1 install chromium

These commands require PowerShell 7. For MyCompany, substitute MyCompany.Api in both paths. If setting PLAYWRIGHT_BROWSERS_PATH, use the same absolute directory during installation and runtime and grant the service account read/execute access. Do not assume an npm browser installation remains compatible after either dependency changes.

Run inside a supported host

The API Dockerfile installs the pinned browser and dependencies and uses an unprivileged runtime account. Compose attaches src/Modules/Reporting/chromium-seccomp.json. Preserve those properties when creating your own image or service definition.

Setting Default Role
Reporting:TimeoutSeconds 60 Rendering time budget
Reporting:MaxConcurrent 2 Per-process rendering capacity
Reporting:MaxFileBytes 8 MiB API output limit
Reporting:MemoryMiB 1152 Configured report memory budget

These are application limits, not a host sizing guarantee. Validate with representative documents and concurrent requests. A Linux host must permit sandboxed Chromium. Local rendering on Fargate remains unsupported in the documented release.

Use the private worker when appropriate

The experimental GhaylStack.PdfWorker can run on a private Linux host that supports Chromium. Build that project and use its own output-directory Playwright installer. Serve it directly over trusted HTTPS; configure the worker secret as PdfWorker__Token.

Configure the API with both Reporting__PdfWorkerUrl=https://print.internal.example:8443/pdf and Reporting__PdfWorkerToken, using the same random secret. Replace the example host. Tokens require at least 32 alphanumeric characters; a random 64-character hexadecimal value meets that format.

The worker accepts HTML up to 16 MiB, authenticates the bearer token, and requires HTTPS. Document HTML leaves the API for this private host. Keep the worker and API on the same revision and restrict network access to the calling service. The worker does not provision its host or TLS, and deployment on AWS has not been validated.

Verify output and diagnose failure

Generate an invoice and a multi-page report in Arabic and English through the application. Check connected Arabic text, totals, headers, page numbers, fonts and tenant access. Verify a restart still locates the browser. Record the tested revision and host.

Missing browser errors usually point to a driver/cache mismatch; permission or sandbox errors require host configuration. Do not disable sandboxing as the default fix. A worker failure fails the request rather than silently choosing a different service. Removing both worker settings returns to local mode only on a host capable of local printing.

Sources

Shared browser, renderers, reporting limits, worker endpoint and deployment guide.

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.