Implementing InDesign

Developers perform these tasks.

Before You Begin

Working with the InDesign designer(s) map out the number of InDesign templates in use, what types of content from the CMS might populate them, and what the unique InDesign Tag names will be for each position on the page(s). This work is necessary to accurately model the InDesignDocument type(s) and InDesignTag type(s) that will be needed.


There are two specific types you will extend: InDesignDocument and InDesignTag.

An InDesignTag maps CMS field values as JSON to allow data to be imported from the CMS to the InDesign file. The tag field value corresponds to the tag name of a tagged container on the InDesign template or document, such as a Text Frame or Rectangle. These containers within InDesign will hold the imported content: text for a Text Frame and an image for a Rectangle.


Although InDesign allows for multiple containers to be tagged with the same tag, Brightspot uses the tagged container as a unique position on the page. Therefore, the InDesign document or template must use a uniquely named tag per individual container.

Additional information on how InDesign uses tags and the backing XML structure that is created off of them can be found at

Below is an example of extending a InDesignTag to fit a project use case mapping an image with custom values.

import com.psddev.indesign.InDesignTag;

public class ImageInDesignTag extends InDesignTag {

    private Image image;
    private String style;

    public ImageTag() {

    public ImageTag(String tag, Image image) {
        this.tag = tag;
        this.image = image;

    public String getType() {
        return "image";

    protected Map<String, String> getTagValues() {
        Map<String, String> values = new HashMap<>();
        if (image != null) {
            StorageItem file = image.getFile();
            if (file != null) {
                values.put("contents", file.getPublicUrl());
                values.put("imageSizes", image.getSizes());
                values.put("caption", image.getCaption());
                if (style != null) {
                    values.put("imageStyle", style);
        return values;

Classes that extend InDesignDocument can connect content to an InDesign file. It can be thought of as the CMS implementation of an InDesign template. Classes that extend InDesignDocument will be displayed as a content edit form within the plugin. It must implement the getTags() method in order to provide data to a tagged InDesign file.

Below is an example of extending a InDesignDocument to fit a project use case creating a Weekly Newsletter Cover that imports data from different content.

import com.psddev.indesign.InDesignDocument;

public class WeeklyNewsletterCover extends InDesignDocument {

    private Article featuredArticle;
    private Article secondaryArticle;
    private Image mainImage;

    public List<InDesignTag> getTags() {
        List<InDesignTag> tags = new ArrayList<>();
        if (featuredArticle != null) {
            tags.add(new FieldDocumentTag("featuredHeadline", featuredArticle, "headline"));
            tags.add(new ImageDocumentTag("featuredImage", featuredArticle.getImage()));
        if (secondaryArticle != null) {
            tags.add(new FieldDocumentTag("secondArticle", secondaryArticle, "headline"));
        if (mainImage != null) {
            tags.add(new ImageDocumentTag("mainImage", mainImage));
        return tags;