Static PDF Documents

Socotra makes it possible to add a pre-authored PDF document to a policy instead of generating one dynamically. In this article, they will be referred to as “static PDFs.”

Capabilities of the feature

  • Use different static PDFs depending on policy details

  • Use a static PDF or generate one dynamically depending on policy details

  • Update a static PDF without affecting existing policies

  • No special configuration needed

  • Option not to generate a document at all depending on policy details

Note

If the render_static_document filter is used, the document template must not output any other content.

Usage

  1. Add any relevant PDF files to the folder /products/{productName}/policy/static_documents/

  2. Configure documents in policy.json and other config files as usual

  3. Use the expression {{ "my_document.pdf" | render_static_document }} in the document template

  4. A copy of the static PDF will be saved onto the policy

To not generate a document at all if certain conditions are met:

  1. Use the expression {{ | render_static_document }} in the document template

Example

Assume a file called “state_disclosure_2020.pdf” exists in /products/{productName}/policy/static_documents/, and that policy.json defines the following policy document:

policy.json

{
    "documents": [
        {
            "displayName": "Regulatory Disclosure",
            "fileName": "state_disclosure.pdf",
            "templateName": "state.disclosure.template.liquid"
        }
    ]
}

Given the above, the render_static_document call instructs Socotra to attach the static PDF to the policy:

state.disclosure.template.liquid

{% if policy_state contains "California" %}
    {{ "state_disclosure_2020.pdf" | render_static_document }}
{% else %}
    {% comment %}
            HTML or another render_static_document call, as desired
    {% endcomment %}
{% endif %}