Embedded Template Editor

You can now embed the DocSpring template editor directly inside your own application.

This is useful when your users need to configure PDF templates, place fields, and publish template changes without switching over to the DocSpring dashboard.

Embedded template editor in a host page, with a PDF open and its fields in the sidebar

How It Works

Add template_editor.js to your page, then open the editor inline or as a modal:

<script
  type="text/javascript"
  src="https://cdn.docspring.com/embed/template_editor.v0.1.0.js"
></script>

<div id="template-editor" style="height: 720px"></div>

<script>
  DocSpring.createTemplateEditor('#template-editor', {
    templateId: 'tpl_123',
    token: 'EMBED_EDIT_TOKEN',
    inline: true,
    externalUser: {
      name: 'Jane Editor',
      email: 'jane@example.com',
      external_id: 'user_123',
    },
    onDone: function (data) {
      // Close your modal or move to the next step in your app.
    },
  })
</script>

The embedded editor always edits the draft template. If versioning is enabled for the embedded editor, users can publish, restore, and delete published versions from inside the editor.


Highlights

  • Inline or Modal Embed the editor inside a page, or open it in a modal with one JavaScript call.
  • Customizable UI Show or hide specific controls with feature options. You can simplify the editor, customize the Done button, force light or dark mode, adjust modal sizing, and control whether settings, versioning, document replacement, schema links, form links, help, and advanced field options are visible.
  • Predefined Fields You can provide a controlled list of field names and data types with predefined_fields. Users can drag predefined fields onto the template.

Dragging a predefined field onto the page, which turns its required asterisk into a check mark

  • Required Predefined Fields Mark predefined fields as required_in_template when they must be added before the user can finish. This is separate from field_required, which controls whether submitted data must include a value for that field.

  • External User Attribution Pass externalUser details from your app so template changes and published versions show the correct editor name, email, and external user ID. If no user details are provided, changes are attributed to Embedded Template User.

  • Server-Enforced Permissions Embedded users can edit template fields by default, but sensitive capabilities are disabled unless you explicitly enable them on the template:

    • embed_edit_allow_settings
    • embed_edit_allow_versioning
    • embed_edit_allow_document_replacement

    When settings access is disabled, sensitive settings such as webhook URLs, redirect URLs, Slack webhook URLs, and PDF encryption passwords are hidden from the embedded editor.


Try It

You can test the embedded template editor here:

https://docspring.com/embed_template_editor_example

You will need a template ID and an embed edit token. You can find the embed edit token on the template settings page.

Documentation

See the full guides here:

If you have any questions or feedback, please contact support.

All updates

Try DocSpring with your own documents

Upload a PDF or create an HTML template, then fill it from our API. No credit card required.

Start Free Trial