Typefi is designed to complement your existing workflows and technology. The Typefi platform is easily integrated with 3rd-party software using our REST API or SDK. Also, Typefi offers a scripting interface that developers can use to expand Typefi’s core functionality further.
Typefi Server SDK
The Typefi Server SDK (Software Development Kit) enables developers to create custom workflow actions in Typefi workflows.
For example, if you have a publishing requirement that Typefi doesn't meet out-of-the-box, you can use the SDK to create your own workflow action.
You can also customise existing workflow actions:
- Use the Apply XSL transform workflow action to convert one type of XML into any other type of XML. You can configure your stylesheet to match your requirements.
- Use the Run Script workflow action to integrate Typefi workflows with 3rd party applications via a command-line interface.
Typefi Server API
The Typefi Server API (Application Programming Interface) is a REST API. Our API provides developers with a standards-based method of interacting with Typefi from 3rd-party applications. The API's focus is to allow for the execution of workflows and the access, retrieval, and modification of assets and projects.
Use the Typefi API to either build a custom application or integrate with your existing platforms. For example, you could even use the Typefi API as a backend and integrate it with your own user interface for a frontend.
Using both the API and SDK is an option too. For example, you can use Typefi's API and SDK together if you want to use your own user interface and create custom workflow actions.
In addition to our API and SDK, there are several ways that developers can use scripting to expand Typefi further.
Expand Typefi with event scripts
Scripting is an essential part of Adobe InDesign when you are creating complex documents. Where you would usually deploy scripts via InDesign's Scripts panel, you can also incorporate event scripts directly into Typefi workflows.
Event scripts are handy when you have specialised requirements that are not supported out-of-the-box by InDesign or Typefi. For example, you could use event scripts to generate custom running heads that are more complex than those supported by built-in InDesign functionality.
Customise Typefi Writer
Typefi Writer also includes hooks for writing customised code. For example, when using Typefi Writer, you may need the Word document to be pre-processed before passing it to Typefi. Pre-processing could include exporting images and relinking them. To accomplish this, you can write custom code that runs before the job is submitted to Typefi. Typefi Writer copies the current working file, runs the custom code on the temporary file, and submits that for processing.
Embed XML from different namespaces
During the automated page composition process, Typefi transforms content into Content XML. Content XML is the data format used by Typefi to encode content. In many Typefi deployments, Content XML is completely hidden from users. Content is marked up and styled in Microsoft Word using Typefi Writer and then converted into Content XML as an intermediate format before the final InDesign document, PDF, EPUB, or other output is generated.
You can embed XML from different namespaces within a Content XML document. By default, Typefi will ignore any XML elements from other namespaces. Alternatively, you can register a new XML handler to specify how the embedded XML is rendered in InDesign.
Register an XML handler
Registering an XML handler means that XML from any custom namespaces will be sent to your custom handler instead of Typefi's built-in handler. Thus, you can configure any number of different handlers for any number of different namespaces.
You can load a custom handler like any other script, using the Events scripts tab in the Create InDesign document or Create InDesign book workflow action. Load the custom handler at the Document start or Book start script event.
processElement method. This method is called by the Typefi processor whenever an XML element with the matching namespace is encountered.
The signature of the
processElement method is:
void processElement(parent: XML, node: XML), where
parentis an ExtendScript XML object representing the parent node of the encountered XML element by the parser, and
nodeis an ExtendScript XML object representing the current node (which matches the custom namespace).
Here is an example of Content XML that contains some embedded MathML:
To register the handler object with Typefi, pass it to the
TYPEFI.xml.Handlers object. Each member of this object is an XML handler, and the key represents the XML namespace. In this example, we are registering two handlers:
Here is a reference implementation of
mathHandler, which passes the embedded MathML as plain text to Typefi:
For more information about customising Typefi, please contact us. We want to help you do more, faster.
Please sign in to leave a comment.