ℹī¸What is ADX?

The Atfinity Document XML (ADX) format is a way to describe what should be on a document and how it should be rendered. It's design is loosely inspired by HTML, so if you are familiar with HTML you will probably feel right at home quickly.

ADX documents are just XML documents that are templated with Jinja to display case information where you need it. To write ADX it helps if you are familiar with XML and Jinja.

Getting Started

Document Structure

An ADX template needs to at least contain a root tag and a body. For everything but testing, you probably also want to add content within the body. A very simple ADX would look like this:

<adx>
  <body>
    <text>
      Hello World! This is an ADX document rendered by Atfinity.
    </text>
  </body>
</adx>

In most cases, you also want to customise the template your content is printed on. You do this by defining a template and then using it, like this:

<adx>
  <pageTemplates>
    <template
      id="simple_header"
      pageSize="A4"
      pageMargins="10cm 2cm 5cm 2cm"
    >
        <text
          bottom="287mm"
          left="20mm"
          width="190mm"
          height="10mm"
          color="blue"
          fontSize="80"
        >
            Header
        </text>
    </template>
  </pageTemplates>
  <body template="simple_header">
    <text>
      Hello World! This is an ADX document rendered by Atfinity.
    </text>
  </body>
</adx>

Above we define a template with the id simple_header and then use it later by setting the template of body to the same id.

Displaying Case Information

To connect such a document to a case, we add some Jinja instructions to place information values and fields. The matches instances of a document conditions are available to you, so you can place information like this:

<adx>
  <body>
    <text>
      Hello World! Here is a field from a person matched in the case {{p.first_name}}
    </text>
  </body>
</adx>

As you can see, Jinja instructions are within {{...}} blocks. They follow a syntax very similar to Python (head to the Jinja documentation for details).

If you want to display a field, you can combine this with a field tag like this:

<adx>
  <body>
    <field title="First Name" type="box_below">
      {{p.first_name}}
    </field>
    <field title="Last Name" type="box_below">
      {{p.last_name}}
    </field>
  </body>
</adx>

Last updated