Skip to content
Back to Knowledge Base

How to Create Templates

Templates are saved text documents — typically JDF or JMF formatted — that can be rendered with dynamic data at runtime. They are used for generating job tickets sent to print equipment.

TypeUse case
JDF TemplateJob Definition Format tickets for CIP4-compatible machines
JMF TemplateJob Messaging Format messages for press control
  1. Go to Menu → Developer → Templates
  2. Click + New Template
  3. Enter a Name and select the Type
  4. Write the template — use {{variable}} syntax for dynamic values
  5. Click Save

Render a template with the renderTemplate GraphQL mutation — by its handle, passing a JSON context string with the values your {{variable}} placeholders reference. From a Workflow Script node:

local res = ctx.graphql.query([[
mutation($tpl: RenderTemplateInput!) {
renderTemplate(input: $tpl) { output }
}
]], {
tpl = {
handle = "hp-indigo-jdf",
context = ctx.json.encode({
jobId = input.jobId,
copies = input.quantity,
substrate = input.paper_type
})
}
})
local ticket = res.data.renderTemplate.output

output is the rendered text. You can also use the GraphQL workflow node to call renderTemplate without writing Lua.

Scripts and Custom Apps can skip the GraphQL round-trip with the direct Lua call. It takes the template handle and a JSON-encoded context string, and returns the rendered text:

local ticket = ctx.template.render("hp-indigo-jdf", ctx.json.encode({
jobId = input.jobId,
copies = input.quantity,
substrate = input.paper_type
}))