PDF Transformation
In this microlearning, we’ll dive into the process of creating PDF documents using eMagiz’s transformation functionality. Unlike standard data transformations between formats like XML, JSON, and EDI, generating a PDF from XML requires a different approach. We’ll cover how to set up your transformation flow with custom XSLT and essential support objects. While visual transformation tools aren’t available for PDF, we’ll guide you through the necessary steps to configure your flow effectively. Let’s explore how to achieve your PDF generation goals with eMagiz.
Should you have any questions, please get in touch with academy@emagiz.com.
1. Prerequisites
- Expert knowledge of the eMagiz platform
2. Key concepts
This microlearning focuses on creating PDF documents with the help of the transformation functionality in eMagiz.
- Custom XSLT is needed
- Support Objects are needed to make the transformation work
3. PDF Transformation
In most cases, you will transform XML messages to other XML messages, or you will transform JSON or EDI messages in another of these formats. However, sometimes you want to create a PDF document as output when transforming your XML data. Just as with the transformations for JSON and EDI, eMagiz also has support objects available that can be used to convert an XML message to a PDF in a similar manner as you are used to for JSON and EDI messages. In this microlearning, we will learn how to configure this solution within the platform.
In contrast to when you transform from XML to JSON or EDI to XML, you cannot use the visual transformation tooling when transforming from your data model message (i.e., XML or JSON) to PDF. This is because the needed PDF structure cannot be visualized via the tooling. However, transforming from XML to PDF works similarly in Create as you are used to transforming from and to JSON and EDI.
So in effect, we need the following to achieve our goal of creating a PDF document via eMagiz:
- Custom XSLT is needed
- Support Objects are needed to make the transformation work
In this microlearning, we will focus on configuring the flow correctly and not on learning how to write a custom XSLT that will transform your message into a valid PDF structure. If you want more information on that, please check out XSL-FO.
When turning to the Create phase of eMagiz, we need to open the flow and enter "Start Editing" mode to add the support objects we need. For example, in the left panel of the flow designer, you can search for the term "FOP." This will yield the following results.
To transform towards PDF, you must add both support objects to your flow. First, let us start with the "FOP XSL-FO result factory." After dragging it onto the canvas, you need to give it a name and save the support object by double clicking on it without making any changes. The same applies to the second component called "FOP XSL-FO result transformer."
After you have added both support objects to the flow, the last step is to link the support objects to your transformation component in the flow. This can be done on the advanced tab of the XSLT transformer component.
4. Key takeaways
- So, in effect we need the following to achieve our goal of creating a PDF document via eMagiz:
- Custom XSLT is needed
- Support Objects are needed to make the transformation work
- Using the tooling to create a PDF document can get very complex, and in almost all cases, other alternatives are preferable to this solution