Skip to content
Reference

Adapter: Document Writer

Render the message or an HTML template to PDF (optionally password protected) or RTF, as the step's output or a file (Mirth Document Writer).

On this page

Purpose

Render the message, or an HTML template that names parts of it, to a PDF or RTF document, as the Mirth Document Writer does. The step sets documentType, template, output, fileName and the page size (pageWidth, pageHeight, pageUnit; US Letter by default). The Mirth importer maps Document Writers to it.

Auth

None for the connection. pdfPassword on the profile protects every PDF the profile writes (AES-256, ISO 32000-2 revision 6): a reader asks for it before opening the document. Set encrypt on a step to refuse to write while the profile has no password, as the importer does for an encrypted Mirth writer. RTF documents are not encrypted, as in Mirth.

How a document is written

  1. The template's ${message} and ${field} references are filled as on the SMTP Sender. The default template is ${message}.
  2. The HTML is read as text blocks: headings, paragraphs, bold, italic, underline, monospace, pre, lists, simple tables, hr and br. Scripts, styles and every attribute are ignored, so no image, font or stylesheet is ever loaded and no remote address is contacted.
  3. output:
    • attachment (default): the step returns { document: { fileName, contentType, base64, bytes } }. Attach it with an SMTP step (attachInputDocument) or write it with an SFTP, S3 or Cloud Storage step.
    • file: written as fileName in the profile's directory. The directory must be inside a folder in FILE_ADAPTER_ROOTS (also after symlinks are resolved); the file is written to a temporary name and renamed.
    • both.
  4. fileName takes the destination naming tokens, for example ${messageControlId}.pdf. It must be one path segment. The default is ${executionId}.pdf (or .rtf).

Settings

Auth is no selector; the secret settings below are the credentials. Dotted names are fields inside an object setting. Secret settings are encrypted at rest, never returned by a read, and shown masked in the console and in exports; their defaults are not shown.

SettingTypeRequiredDefaultSecretDescription
directorystringNoNoFolder for file output: an absolute path inside FILE_ADAPTER_ROOTS. Not needed for attachment output.
pdfPasswordstringNoYesPassword needed to open the PDFs (AES-256). RTF documents are not encrypted.

Actions

A trailing ? marks an optional step parameter. A message can supply only the keys in the last column; everything else comes from the step.

ActionWhat it doesStep parametersKeys a message may supply
sendRender one document for the message.documentType?, template?, output?, fileName?, encrypt?, pageWidth?, pageHeight?, pageUnit?None

Minimal example

The smallest profile the engine accepts: the required settings only, with synthetic values. Create it with POST /api/adapter-profiles, then test it with POST /api/adapter-profiles/{id}/test.

json
{
  "name": "Document Writer (example)",
  "adapterType": "document-writer",
  "config": {}
}

Limits

  • The PDF uses the standard Helvetica and Courier fonts, which cover Western European text (WinAnsi). Other characters print as ?.
  • No images, colours, CSS or page headers; tables have equal column widths.
  • A rendered template up to 2 MB, at most 1,000 pages, a document up to 20 MB, and pages between 1 and 100 inches on each side.
  • At most 100,000 drawing operations in a PDF. Each line of text in one style is one operation, and so is each table cell line, underline and rule. Plain text reaches the 1,000-page limit first. A dense table does not: a letter page holds about 42 table rows, so a 10-column table of one-line cells stops at 10,000 rows, about 240 pages, and wider tables or cells that wrap stop sooner. The step is refused with "The document has more than 100000 drawing operations".
  • A table row has at most 100 cells.
  • With no FILE_ADAPTER_ROOTS, file output is refused.

Reference