from Patrick Gundlach |

speedata Publisher and AI

Categories: Development

Don’t worry, the speedata Publisher will not gain any half-baked, annoying artificial intelligence features. This post is about chatting with some of the more famous AI chats (ChatGPT, Google Gemini, DeepSeek). I have tried to find out how good these AI chats know the speedata Publisher and if they can help users to generate a layout.

There is still a long road ahead, but read on. A big warning upfront: None the following outputs work. Do not use them. I post abbreviated transcripts of the chats.

Table of contents:

Chat GPT

me: Do you know the speedata Publisher?

ChatGPT: Yes! Speedata Publisher is an open-source automated publishing system designed for high-volume and complex document generation, especially for structured data like catalogs, financial reports, and technical documents. It uses XML and Lua to define document layouts and logic, making it highly customizable for professional publishing needs.

It’s particularly useful when you need precise typography and layout control, similar to tools like TeX or InDesign scripting, but optimized for structured data.

Are you considering using it for a project?

me: can you generate a simple layout for the speedata publisher just printing a “hello chatgpt”?

ChatGPT: Sure! Here’s a simple Speedata Publisher layout file that prints “Hello ChatGPT” on a page. Save this as an XML file and run it with Speedata Publisher.

<?xml version="1.0" encoding="utf-8"?>
<document xmlns="https://www.speedata.de/2012/publisher/en">
    <setup>
        <pagelayout name="mainlayout">
            <positioningarea width="210mm" height="297mm">
                <text top="50mm" left="50mm" fontsize="20pt">
                    Hello ChatGPT
                </text>
            </positioningarea>
        </pagelayout>
    </setup>

    <record>
        <page>
            <usepagelayout name="mainlayout"/>
        </page>
    </record>
</document>

Explanation:

  • Defines a page layout (mainlayout) of A4 size.
  • Places “Hello ChatGPT” at 50mm from the top and left.
  • Creates a record that generates a page using the defined layout.

Would you like to extend this with styles, different fonts, or dynamic content? 🚀

me: The speedata Publisher needs a data file, can you show it to me as well?

ChatGPT: You’re absolutely right! Speedata Publisher requires a data file along with the layout. Here’s a minimal data file to use with the previous layout:

data.xml

<?xml version="1.0" encoding="utf-8"?>
<data>
    <text>Hello ChatGPT</text>
</data>

Updated Layout File (layout.xml)

Now, let’s modify the layout to fetch data dynamically instead of hardcoding the text:

<?xml version="1.0" encoding="utf-8"?>
<document xmlns="https://www.speedata.de/2012/publisher/en">
    <setup>
        <pagelayout name="mainlayout">
            <positioningarea width="210mm" height="297mm">
                <text top="50mm" left="50mm" fontsize="20pt">
                    <value select="text"/>
                </text>
            </positioningarea>
        </pagelayout>
    </setup>

    <record element="data">
        <page>
            <usepagelayout name="mainlayout"/>
        </page>
    </record>
</document>

How it Works:

  1. data.xml contains the text inside a <text> element.
  2. The layout file dynamically fetches the text using <value select="text"/>.
  3. When you run Speedata Publisher with both files, it will output “Hello ChatGPT”.

Google Gemini

me: do you know the speedata Publisher?

Gemini: Yes, I do!

Speedata Publisher is a powerful and versatile typesetting software that’s particularly well-suited for creating complex documents with a high degree of automation. It’s known for its ability to handle large volumes of data and produce professional-quality output.  

Here’s what I know about Speedata Publisher:

[…]

I’m ready to assist you further! Just let me know what you’d like to know.

me: can you generate a simple layout for the speedata publisher just printing a “hello gemini”?

Gemini:

<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://speedata.org/2021/03/speedata">
  <layout>
    <page>
      <frame x="1cm" y="1cm" width="10cm" height="2cm">
        <text>Hello Gemini</text>
      </frame>
    </page>
  </layout>
</document>

Explanation:

  • <?xml version="1.0" encoding="UTF-8"?>: Standard XML declaration.
  • <document xmlns="http://speedata.org/2021/03/speedata">: The root element, declaring the Speedata namespace. This is crucial.
  • <layout>: Contains the layout definition.
  • <page>: Defines a single page. You can have multiple <page> elements for multi-page documents.
  • <frame x="1cm" y="1cm" width="10cm" height="2cm">: Defines a rectangular area on the page.
    • x and y attributes specify the top-left corner’s position (1cm from the left and 1cm from the top).
    • width and height define the dimensions of the frame.
  • <text>Hello Gemini</text>: The content to be printed within the frame.

How to use this:

  1. Save: Save this code as an XML file (e.g., hello.xml).
  2. Run Speedata: Open a terminal or command prompt and navigate to the directory where you saved the file. Then, run Speedata Publisher using the command: speedata hello.xml
  3. This will generate a PDF file (usually named hello.pdf) containing your “Hello Gemini” text.

Key improvements and considerations:

  • Namespace: The xmlns attribute in the <document> tag is essential for Speedata to understand the XML structure.
  • Units: Using units like cm (centimeters) is good practice for defining sizes and positions. Speedata supports various units (mm, in, pt, etc.).
  • Frame: The <frame> element is important for positioning content precisely. Without it, the text might be placed at the default position.
  • Error Handling: If you encounter errors, double-check the XML syntax and make sure Speedata is installed correctly. The command-line output will often provide clues about the problem. This example provides a very basic layout. Speedata Publisher is capable of much more complex layouts with sophisticated formatting, data integration, and conditional rules. If you have more specific layout requirements, let me know, and I’ll do my best to help you create the appropriate Speedata code.

DeepSeek

me: do you know the speedata publisher?

DeepSeek: Yes, Speedata Publisher is a specialized software tool designed for automated typesetting and layout generation, particularly for complex documents like catalogs, directories, and price lists. It uses a data-driven approach, allowing users to define layouts through XML or JSON data and templates. This makes it highly efficient for handling large datasets and generating consistent, high-quality layouts.

Key features of Speedata Publisher include:

[…]

me: can you generate a simple layout for the speedata publisher just printing a “hello deepseek”?

DeepSeek: Certainly! Below is a simple example of how you can create a layout in Speedata Publisher to print “Hello Deepseek”. This example assumes you have a basic understanding of XML and how Speedata Publisher works. Step 1: Create the Data File (data.xml) This file contains the data you want to display in your layout.

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <message>Hello Deepseek</message>
</data>

Step 2: Create the Layout File (layout.xml) This file defines the layout and how the data should be displayed.

<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="urn:speedata.de:2009/publisher/en"
        xmlns:sd="urn:speedata:2009/publisher/functions/en">

    <!-- Define a page template -->
    <Pageformat width="210mm" height="297mm" /> <!-- A4 size -->
    <DefinePage name="main" width="210mm" height="297mm">
        <PlaceObject column="1" row="1">
            <Textblock>
                <Paragraph>
                    <Value select="/data/message" /> <!-- Insert the message from the data file -->
                </Paragraph>
            </Textblock>
        </PlaceObject>
    </DefinePage>

    <!-- Start the layout with the "main" page -->
    <Record element="data">
        <ClearPage />
        <UsePage name="main" />
    </Record>
</Layout>

Step 3: Run Speedata Publisher

To generate the PDF, run the Speedata Publisher command with the data and layout files:

sp data.xml layout.xml

This will produce a PDF file with “Hello Deepseek” printed on an A4-sized page. Explanation:

  1. data.xml: Contains the message “Hello Deepseek” in a structured format.
  2. layout.xml: Defines the layout, including the page size (A4) and where the message should be placed (column 1, row 1).
  3. Speedata Command: The sp command processes the data and layout files to generate the PDF.

Conclusion

The correct answer would be something like this:

The data.xml file:

<data>Hello world!</data>

and the layout file (layout.xml)

<Layout
  xmlns="urn:speedata.de:2009/publisher/en"
  xmlns:sd="urn:speedata:2009/publisher/functions/en">

  <Record element="data">
    <PlaceObject>
      <Textblock>
        <Paragraph>
          <Value select="."/>
        </Paragraph>
      </Textblock>
    </PlaceObject>
  </Record>
</Layout>

and to run the speedata Publisher, just call sp on the command line.

To be honest: all three chat AI gave really bad answers. The ChatGPT and the Gemini answers were totally useless, the DeepSeek AI gave a bit better answer, at least it outputs some commands that are actually part of the speedata Publisher layout language.

I know that the speedata Publisher is a niche product where you cannot find many examples on the web. So it is hard for the limited AI data models to output anything useful. I was impressed by DeepSeek that it outputs at least a few sensible speedata Publisher commands. I should re-visit the chats in a few years and update this blog entry.