Two Great Ways to Use Conditional Text to Create Different Versions of an Adobe InDesign Document Without Creating More Files

Use One Layout but Hide or Reveal the Display of Prices in Different Currencies or Text in Multiple Languages

We at T+S apply the “conditional text” function in conjunction with InDesign scripting to manage various versions of a single document more easily. What is conditional text, and how can it be applied to simplify working with documents containing multiple prices or languages? In this blog post, we explain what conditional text does and give two examples of how using conditional text can simplify working with multiple versions of one layout.

Conditional text is a standard function in Adobe InDesign. It can be found in the Window menu > Type & Tables > Conditional Text. By using conditional text, a graphic designer can assign specific text to a category (condition) defined and given a name by the designer. For instance, in a price list, a given price (which appears as text in a document) can be categorized as “Euro price” or “American dollar price.” Once the relevant text is marked and assigned to the proper category, the text can be displayed or hidden by clicking to apply the condition. InDesign automatically hides the non-relevant text when the condition is applied.

Applying conditional text allows a designer to better manage changes to text in a single document, greatly simplifying workflows in the process. The alternative would be to create separate individual documents; say, one price list document containing only prices in Euros and another, separate price list containing only prices in American dollars. The advantage of using only one price list with conditional text is that when it comes time to update all prices, in the document with conditional text, there is only one document to manage. Changes are made only to one document. There is no need to save, locate, or update a second document.

When price lists come in not just two versions, but ten or more, updating prices is immensely simplified and faster when conditional text is used.

Our second example concerns a catalog to be produced in five languages. One document containing text in all five languages is created and managed. All English-language text in the catalog is assigned to the category (condition) “English,” the Spanish text is assigned to the category “Spanish,” the French text is assigned to “French,” and so on for the other two languages. When the Spanish-language catalog is to be output to a PDF file, the condition “Spanish” is applied. Immediately, the text of the other four languages is hidden and only the text marked “Spanish” can be seen. The Spanish catalog is then generated. The four remaining catalogs can be generated similarly by applying the respective condition in turn. Thus, one document is managed, but five versions of the catalog can be outputted.

Conditions can even be defined and then combined in sets. It is thus possible to create various versions of a catalog that match multiple conditions; for example, “price is in British pounds and language is GB-English,” “price is in American dollars and language is US-English,” and “price is in Euros and language is GB-English.”

In summary, using conditional text improves productivity by eliminating time spend updating multiple versions of a document when managing one would be simpler. It also obviates the need for dealing with layers.

Get in touch about InDesign scripting now

Discover a world of document production possibilities with InDesign scripting from T+S. Discuss your needs with our experts.

Two Great Ways to Use Conditional Text to Create Different Versions of an Adobe InDesign Document Without Creating More Files Read More »

Data Sources for InDesign Scripting Workflows

Category: General

We at T+S are often asked by our customers which data sources can be attached to InDesign scripting extensions or plugins.

One can distinguish between online data sources and offline data sources. An online data source is a live access of a database or product information management (PIM) database. On the other hand, an offline data source is always a file created by a data system and processed within InDesign at a later time. Both online and offline data sources have advantages and disadvantages that depend on how they are used.

InDesign extensions (also called plugins) can work with the following offline data sources:

  • Excel files
  • CSV files
  • XML files
  • JSON files

Offline data sources that InDesign can work with include:

  • Web service (REST or SOAP)
  • ODBC data access
  • Native database drivers

Excel files

Excel files can be read directly by an InDesign plugin. We at T+S do not recommend this approach, however, because Excel files can contain quite a few “pitfalls” such as faded out columns, formatted cells, or applied filter conditions. These modifications have to be taken into account during an import, making the development of the import routine time-consuming before one even comes to the actual task at hand — automation.

It is more elegant to insert the content of an Excel file using the clipboard with copy and paste in a text field within a plugin developed by T+S. The method of using the clipboard removes all formatting, making the import routine quick and manageable. This approach always yields a text file separated by tabs.

CSV files

CSV files are flat text files that in the first row contain a header definition of the data fields and starting in the second row contain the actual data. Data fields of a data set are normally separated by a comma, semicolon, or tab. When the field separator character also can be found within the relevant data to be used, the affected fields have to be escaped by quotation marks (quotes).

XML files

XML files are an elegant and efficient way of obtaining data with multiple-level hierarchies (1:n relationships) from a source. Using an InDesign plugin to work with XML files that are several hundred megabytes large can be done easily. However, some time may be needed between generating the XML files and reading them in.

JSON files (JavaScript Object Notation)

JSON files are used primarily to exchange data with web services. They are, just like XML files, an elegant and efficient way to transfer structured hierarchical data from a database system to a plugin.

Web service (REST or SOAP)

A web service is a service that makes available data through the http or https protocols. This service normally receives its data from a database or a product information management (PIM) system.

The advantage of having an InDesign plugin receive its data from a web service is the currency of the data, because the access takes place online. In the case of CSV, XML, or JSON files, there is always a bit of a span of time between when the files are created and when the files are read into the plugin.

ODBC database driver

Connecting InDesign Plugins to a database using ODBC is only possible with third party plugins. So we do not recommend this possibility.

Native database driver

For Microsoft SQL Server and MySQL, we have successfully used JavaScript libraries to directly access databases. The advantage is the same as with a web service in that the data is current because the access takes place online.

However, every time the database is updated, there is the question beforehand of whether afterwards the plugin will access the data tables successfully. It is therefore necessary to very carefully evaluate the advantages and disadvantages of this method.

Get in touch about InDesign scripting now

Discover a world of document production possibilities with InDesign scripting from T+S. Discuss your needs with our experts.

Data Sources for InDesign Scripting Workflows Read More »

Scroll to Top