PDF Studio

PDF Studio is an AI-assisted development environment for creating Typst templates, mounted by the pdf extension at /chat/pdf. It combines a Typst editor, a live PDF preview, schema-generated data forms, visual formatting controls and AI-assisted editing.

This page covers authoring. For publishing, production rendering and typed C# integration see Rendering PDFs.

The lifecycle

PDF Studio is only the authoring half. Everything after Publish is a controlled software artifact, and production rendering never calls an LLM.

Capability Plugin Runtime dependencies
AI-assisted authoring and live preview ChatFeature PDF extension Typst and an AI provider
Published template management and rendering PdfFeature Typst

Requirements

PDF Studio shells out to the Typst CLI and disables itself when it isn't found:

brew install typst

cargo install --locked typst-cli

The extension resolves typst from PATH. PdfFeature additionally honours $TYPST_PATH.

services.AddPlugin(new ChatFeature {
    DisableExtensions = ["pdf"],   // remove PDF Studio explicitly
});

Per-user workspaces

Each user's templates live under:

Developers and designers experiment independently, and nothing becomes a shared runtime template until an administrator explicitly publishes it. PDF Studio inherits Integrated Auth, so existing application users enter with their current identity while their drafts, assets and experiments stay isolated.

Publishing is a separate Admin-authorized boundary - access to the designer does not imply permission to change the templates production uses.

Anatomy of a document

A document named invoice normally consists of:

This separation makes templates easier to design, test, review and integrate than documents where layout and business data are inseparable.

Editing document data

The JSON data can be edited directly in Code View, or through a Form View generated from invoice.ui.json - labels, date inputs, enum selections and add/remove controls for line items, without requiring anyone to edit JSON.

Every edit uses the same data contract that later generates the application's C# model, so the preview isn't a disconnected design mock-up - it's an executable example of the production template.

Edit with AI

The Edit with AI panel gives the Model the current template, its data and any referenced partials, then applies the complete updated files it returns and recompiles immediately.

Add a Paid watermark when the outstanding balance is zero.

Move the totals into a bordered box and show tax on a separate row.

Reformat this as a 4×6 shipping label with no page margins.

If the first edit fails to compile, the Model gets a repair pass with the compiler error.

AI edits update editor buffers rather than silently committing files - unsaved changes stay visible and the previous contents can be restored, which makes experimentation fast and reversible.

Recreate a document with vision

Starting from a blank page is rarely necessary. Attach screenshots, photos or rasterized pages from an existing PDF and ask a vision-capable model to reproduce the design as a reusable Typst template with its own JSON data model.

INFO

This is visual reconstruction, not structural PDF conversion. The original document's text objects, fonts, forms, annotations and metadata are not preserved - but it's an extraordinarily fast way to turn a legacy document into maintainable source.

Visual formatting controls

For authors who don't want to memorize Typst:

  • Font discovery and preview
  • Font size, weight and line height
  • Page sizes from A3–A6, Letter, Legal and presentation formats
  • Portrait and landscape orientation
  • Margins
  • Image and asset selection
  • Shared library previews

The controls modify source rather than hiding it - developers keep a readable Typst template whilst less experienced authors can make common visual changes confidently.

Versioned design systems

Shared document design belongs in a library, but changing that library shouldn't unexpectedly reflow every historical template.

New workspaces use explicit imports such as lib/v1.typ, holding shared fonts, colors, formatters, headers and footers. An incompatible redesign becomes lib/v2.typ, letting templates migrate one at a time.

lib/v1.preview.typ renders the design system itself, so typography and components can be checked independently:

PDF Studio tracks direct and transitive dependencies: a referenced library cannot be renamed or deleted until its dependants are moved, and publishing captures the exact imported library with the document's artifact set.

Assets

Images a template can #image() are limited to what Typst reads - .png, .jpg, .jpeg, .gif, .svg, .webp - and uploads are checked against their magic bytes rather than trusted by extension.

Setting Default
Pdf.AssetExtensions .png .jpg .jpeg .gif .svg .webp
Pdf.MaxAssetBytes 20 MB
Pdf.MaxPdfBytes 50 MB
Pdf.RenderTimeout 30s
services.AddPlugin(new ChatFeature {
    Pdf = {
        RenderTimeout = TimeSpan.FromSeconds(60),
        MaxAssetBytes = 5 * 1024 * 1024,
    },
});

Renders are serialized per user, since a user's templates all compile out of the same mirror directory.

API

Next

Once a document is ready, an administrator publishes it into App_Data/pdf, where it becomes a validated immutable revision your application can render deterministically.

Rendering PDFs →