What Spooldoc does

Spooldoc reads each spooled file your IBM i (AS/400, iSeries) prints into data. A template in HTML, Word or Excel then lays that data out as a PDF, Word or Excel document. The template never sees lines and columns, so a new look is a new template, and a moved column is one fix in the definition. Nothing is installed on the IBM i, and your programs need no changes.

Servers and queues

Spooldoc reads what your programs already print. It connects through jt400 over the host server ports, so nothing is installed on the IBM i and no program changes.

Add an IBM i with a host, a user profile and its password. Spooldoc signs on when you save, so a wrong host or password shows up at once. The password is stored encrypted.

The Queues page lists the output queues of a server with their ready, held and total files. Search, sort and hide the queues you never need. Open a queue to list its spooled files, and look at any of them page by page.

When a server cannot be reached, its status says why and what to check, and it shows under Needs attention on the Home page.

Read the Servers guide and Queues

Definitions in YAML

A definition is a short YAML document that reads the pages of a spooled file into JSON. Fields are found by label, pattern or position. Tables, multi-line records and split keys cover page groups printed back to back, such as one invoice each. XML in a spooled file is read too.

Reading and layout stay apart. A template lays out the JSON and never sees lines and columns. A new look is a new template, and a moved column is one fix in the definition.

The workbench checks the YAML as you type and highlights every field it finds on the page. You check each value next to the line it came from, before anything is rendered.

Read the Definitions guide

type: sales-invoice
version: 1
source: text
match:
  splf: SPDINVOICE
  page1: MYCO LTD
text:
  page:
    width: 132
    length: 66
  footer:
    fromLine: 60
  split:
    field: invoiceNo
  fields:
    - name: invoiceNo
      anchor:
        regex: 'Invoice no\.+: (\S+)'
      page: all
    - name: invoiceDate
      anchor:
        regex: 'Invoice date\.+: (\S+)'
      type: date

Lookups from Db2 for i

Many printed documents leave out something the document needs, most often the customer's email address. A lookup reads it from Db2 for i instead, so the program and its spooled file stay as they are.

A lookup is one SELECT. It takes values the definition read, such as the customer number, as bound parameters, never written into the SQL, and runs on a read-only connection. Its rows join the page group's data, so templates and email fields use them like any field: {d.pg.customer.EMAIL}.

A lookup can run once per row of a table, such as the description of each item, and use the columns of an earlier one, such as the customer's language. When no row is found, the run stops, warns or leaves the columns empty, as you choose.

Test runs a lookup on the job's server with the values of the page group shown: each parameter with its Db2 for i type, the rows, and the tags to copy. A version is saved only with lookups that were tested.

Values that are not in Db2 for i, such as the text of a payment terms code, go in a lookup table kept in Spooldoc. Edit it in a grid, or import a CSV file or cells pasted from a spreadsheet. A lookup matches its rows on key columns, with no SQL and no server, and the job log names the table and the revision each run read.

Read the Lookups guide

Templates you already know

A template is an HTML page, a Word document made in Word or an Excel workbook made in Excel, with Carbone tags such as {d.pg.invoiceNo}. Each page group becomes a document through every template of the job, in that template's formats.

Upload a Word or Excel template, or let the agent design one. An Excel template can make one sheet of the whole spooled file, a row per line, to sort, filter and sum.

Spooldoc checks every tag against the definition before it renders. A Carbone server of your own or Carbone Cloud renders the documents. Logos, images and fonts are uploaded once, as assets.

Read the Templates guide and Carbone

The agent

The agent sits beside the job builder. From a sample spooled file it writes the definition, reads the extraction report and fixes what is missing. Then it writes a template and renders it: HTML, or a Word or Excel template it designs or edits, looking at every page it renders.

It uses an AI model you choose: Anthropic, Google, OpenAI, OpenRouter, Vercel AI Gateway or a local model behind an OpenAI-compatible endpoint. Spooldoc works without a model.

Nothing it writes goes live until you save and activate a version, and none of its tools reaches the IBM i. With masking on, the model sees the layout and not the values. A local model keeps the values on your network.

Read the Agent guide

The agent panel beside the workbench shows the suggested prompts, one per kind of template, and the message box.The agent panel beside the workbench shows the suggested prompts, one per kind of template, and the message box.

Jobs as pipelines

A job takes the spooled files of one output queue to a destination. The job builder shows it as seven steps: source, trigger, extract, lookups, render, destination and finish. The draft saves as you type.

Saving a version takes a fixed copy of the draft, with a note of what changed. Runs use the active version, and every run is logged against the version it used. Restore an older version to go back.

Run a job on demand on the files you pick, or let it watch the queue. Watching works by polling, or in real time through a data queue that Spooldoc creates only when you turn real-time watching on. When the documents are delivered, the finish step holds, moves, deletes or leaves the spooled file. Delete asks first.

Read the Jobs guide and Lookups

Job log

Every run of every job is in the job log: the version it used, the spooled file, what started it, its status and the files it delivered. Open a run to see its steps: capture, extract, lookups when the job has some, render, deliver and finish.

A failed run says which step failed and why, in IBM i terms: the object, the authority and the command that fixes it. The IBM i's own message is kept under Details. Failed runs show under Needs attention on the Home page.

With alerts on, you get one email when a run fails or watching stops, and one when it works again.

Retry runs the same spooled file again with the active version. Runs are kept for 90 days by default, and you set how long.

Read the Job log guide

Download, IFS, email, webhooks and SFTP

The built-in destination keeps every file in Spooldoc, ready to download from the run in the job log.

An IFS destination writes each file to a folder on the job's IBM i, where programs can pick it up. Each file is tagged with the right CCSID and is never half written. When a file with the same name exists, the destination replaces it, adds a number or fails the run, as you choose.

An email destination sends one email per document through your SMTP server or Microsoft 365. To, Subject and the message take fields such as {d.pg.email}, so each invoice goes to the customer on it, with its PDF attached. When the address is not printed, a lookup reads it from Db2 for i. The message can be the document itself, from an HTML template. The job builder shows the email of each page group before anything is sent, and a test address sends every email to you first.

A webhook destination posts one call per document to your URL: JSON with the fields the definition read and the files in the formats you pick, signed the Standard Webhooks way so the receiver can check it came from Spooldoc. The job builder shows the call of each page group with the real values, and Send test posts it and shows the answer. A test URL takes every call while you try it.

An SFTP destination uploads each file to a folder on a server, such as a bank or an EDI partner. Spooldoc makes the key and shows the public key line to add to the server. Check connection prints each step with its real values and stops at a new host key until you compare its fingerprint and trust it. In the job builder, the folder on the server is listed live with the page group's files placed in it, each tagged with what a run will do, and Upload test puts them in a test folder. Each file is written under a temporary name and renamed when it is whole.

Routes send each document by its fields: email the invoices of customers who have an address, and write the rest to an IFS folder. Each document takes the first route whose conditions it matches, and a route can send to several destinations. The job builder shows which route each page group takes, and why, before anything is sent. A document that no route takes fails the run, and the job log names it.

The spooled file is held, moved or deleted only after every document was delivered. When an email, a call, an upload or a file written to the IFS fails, the job log lists each one with its status, and Retry sends only what was not sent yet.

Read the Destinations guide

One Compose file

The Compose file starts the published image with a Postgres database and a Carbone server. The image holds the web app and the Java runtime for jt400, and runs on amd64 and arm64.

Every release publishes the image to ghcr.io/strom-capital/spooldoc, tagged with its version. Pin a version in production, so an upgrade happens when you choose. The server applies its database migrations when it starts.

Spooldoc runs next to the IBM i, not on it. It needs a route to the host server ports, and nothing else on the IBM i.

Read the Deployment guide and Getting started

The Home page shows counts of servers, output queues, jobs and runs, a chart of runs per day by status, and two items under Needs attention: a server that cannot be reached and a failed run.The Home page shows counts of servers, output queues, jobs and runs, a chart of runs per day by status, and two items under Needs attention: a server that cannot be reached and a failed run.
git clone https://github.com/Strom-Capital/spooldoc.git
cd spooldoc
printf 'BETTER_AUTH_SECRET=%s\nSPOOLDOC_SECRET_KEY=%s\n' \
  "$(openssl rand -base64 32)" \
  "$(openssl rand -base64 32)" > .env
docker compose up -d