CodamAIDocs
Topicdone

Output types and formats

A template's output type (DOCUMENT, TABLE, WORD) decides which formats it delivers: HTML and PDF, XLSX, CSV and ODS, DOCX. Which formats an installation offers and which PDF profiles exist.

Variants
DOCUMENT → HTML, PDFTABLE → XLSX, CSV, ODSWORD → DOCXPDF profiles NONE, PDF_A_3A, PDF_UA, PDF_A_3A_UAformat not offered → format-not-offeredformat does not fit the template → format-not-for-template

What this is about

Every template has an output type. It says what the template produces, and with that, which formats it can be rendered into. A format is the kind of file you get at the end, for example PDF or XLSX.

CRMS guesses no structure. A table does not come about by CRMS taking an HTML document apart. If you want an Excel file, you write a template of type TABLE.

The three output types

What a template produces and what becomes of it
DOCUMENTTABLEWORD
The template writesXHTMLthe CRMS table document (a small XML)WordprocessingML as Flat OPC (the whole package as one XML file)
FormatsHTML, PDFXLSX, CSV, ODSDOCX
Escaping in the templateXHTMLXMLXML
Own files (assets)asset:<name> in src, href, CSS url()–asset:<name> in <pkg:binaryData>
Pictures from the requestfor PDFnono
SVG with crms.svgas vector graphics (PDF) or inline (HTML)noas an embedded picture

Escaping means: special characters from the payload, such as < or &, end up in the document as text and never as markup. This happens automatically for every output type. Markup from the payload only reaches the document through crms.svg, see Pictures and SVG.

Assets are files that belong to a revision of the template, for example a logo or a font. They are approved together with the template. More in How a template is built.

DOCUMENT: HTML and PDF

The template writes XHTML. HTML returns this XHTML and makes it self-contained: every asset:<name> becomes a data: address, so the page shows its logo without CRMS and without the network.

PDF lays the XHTML out into pages with openhtmltopdf. Fonts are embedded. Text without a font of the template gets DejaVu Sans from CRMS, never a font of the server. If the <html> element has no lang, CRMS sets the document’s language.

TABLE: XLSX, CSV, ODS

The template writes the CRMS table document:

<workbook>
  <sheet name="Items">
    <column width="30"/>
    <row header="true"><cell>Item</cell><cell>Amount</cell><cell>Due</cell></row>
    <#list items as item>
    <row>
      <cell>${item.label}</cell>
      <cell type="number" format="#,##0.00">${item.amount?c}</cell>
      <cell type="date">2026-10-17</cell>
    </row>
    </#list>
  </sheet>
</workbook>
  • Cell types: string (default), number, date (ISO), datetime (ISO with offset), boolean.
  • format is a number or date format for XLSX and ODS.
  • column width is the width in characters, row header="true" a bold header row.
  • A sheet name has at most 31 characters, none of [ ] : * ? / \, and is unique in the document.
  • There are no formulas. Every value is prepared. In CSV, text that starts with =, +, -, @, tab or carriage return gets a leading ', so a spreadsheet does not run it as a formula.
  • CSV has exactly one sheet. A document with more sheets is render-csv-single-sheet. CSV is UTF-8 without BOM, with comma and CRLF.

A broken table document (unknown element, DOCTYPE, no sheet) is render-table-invalid|<line>|<column>.

WORD: DOCX

The template writes the whole Word package as one XML file (Flat OPC). CRMS packs the DOCX file from it. CRMS fills <pkg:binaryData>asset:logo.png</pkg:binaryData> with the revision’s asset. An external relationship other than a hyperlink, for example an externally attached template or a picture from the network, is render-resource-refused. Broken XML is render-word-invalid|<line>|<column>.

Which formats an installation offers

Not every installation offers every format. Two things decide:

  1. Which format modules are installed. HTML is always there. PDF comes from the PDF format module, DOCX from the DOCX format module, XLSX, CSV and ODS from the table format module.
  2. What the configuration offers. CODAMAI_CRMS_FORMATS lists the offered formats. Empty means: all installed ones. If the list names a format for which no module is installed, the application does not start.

In the hub you choose the formats on the CRMS module, see The CRMS module in the hub. Which formats are offered right now is reported by GET /crms/capabilities.

Format offered and installed?Fits the template's output type?Result
no–422 format-not-offered|<format>
yesno422 format-not-for-template|<format>|<output type>, e.g. format-not-for-template|docx|document
yesyesCRMS renders

PDF profiles

A PDF profile sets which standard a PDF meets. You choose it with pdfProfile in the request, only with format: PDF. If it is missing, the installation’s default profile applies (CODAMAI_CRMS_PDF_PROFILE, default PDF_A_3A).

ProfileStandardTaggedWhat for
NONEplain PDFnoquick view
PDF_A_3APDF/A-3a (ISO 19005-3), with sRGB color profileyeslong-term archiving
PDF_UAPDF/UA-1 (ISO 14289-1)yesaccessibility
PDF_A_3A_UAPDF/A-3a and PDF/UA-1 at onceyesarchivable and accessible

Tagged means: the PDF contains a structure of headings, paragraphs and tables that, for example, a screen reader can read out.

Pitfalls

Next

Search