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).
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
- The template's
${message}and${field}references are filled as on the SMTP Sender. The default template is${message}. - The HTML is read as text blocks: headings, paragraphs, bold, italic, underline, monospace,
pre, lists, simple tables,hrandbr. Scripts, styles and every attribute are ignored, so no image, font or stylesheet is ever loaded and no remote address is contacted. 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 asfileNamein the profile'sdirectory. The directory must be inside a folder inFILE_ADAPTER_ROOTS(also after symlinks are resolved); the file is written to a temporary name and renamed.both.
fileNametakes 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.
| Setting | Type | Required | Default | Secret | Description |
|---|---|---|---|---|---|
directory | string | No | No | Folder for file output: an absolute path inside FILE_ADAPTER_ROOTS. Not needed for attachment output. | |
pdfPassword | string | No | Yes | Password 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.
| Action | What it does | Step parameters | Keys a message may supply |
|---|---|---|---|
send | Render 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.
{
"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.