Topics

InDesignDocument


In This Guide

Classes that extend InDesignDocument export content from Brightspot to an InDesign document. These classes must implement the getTags() method. Editors open InDesignDocument subclasses in Brightspot to synchronize content as described in Using InDesign with Brightspot.

The following snippet is an example of extending InDesignDocument to export fields from Brightspot articles to a tagged InDesign document.

import com.psddev.indesign.InDesignDocument;

public class WeeklyNewsletterCover extends InDesignDocument {

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

    /* Getters and setters */

    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("secondHeadline", secondaryArticle, "headline"));
        }
        if (mainImage != null) {
            tags.add(new ImageDocumentTag("mainImage", mainImage));
        }
        return tags;
    }
}
  • Declares the Article and Image content types exported to InDesign.
  • Implements the getTags method. For each Article and Image instance, this method maps Brightspot fields to a corresponding InDesign tag. For example, data from the Brightspot headline field is mapped to the InDesign featuredHeadline tag.

  • Illustrates the instantiation of InDesign tags within Brightspot. InDesign tag data is represented by a tag class (such as FieldDocumentTag and ImageDocumentTag) that extends InDesignTag.

In This Guide