Generate product data sheets automatically – how it works
There are different techniques to automatically generate product data sheets – you can either use local applications on your desktop or you can use server-based services. For locally installed software, Adobe InDesign is widely used for typesetting promotional documents; but it has the disadvantage that the file format created by this program cannot be easily reproduced with non-Adobe software.
Automatically generate data sheets locally via Office programs
Office programs can be an alternative to InDesign. An office document is reproducible, making it suitable for template-based creation of printed papers. For the format you can choose between MS-Office (format: Office Open XML – but see also the Comments) and LibreOffice (Open Document).
Many companies work with the common MS Office programs. To create product data sheets automatically via Word, Excel or PowerPoint, you can connect your product data with existing templates locally at the workstation via batch run. The data source here can be your PIM system, a database, or a JSON or XML file like BMECat. A helpful tool that facilitates setting up templates for this would be docx42, for example.
Alternative: report designers like JasperStudio
A very good alternative to office programs is the generation of template-based output via a report generator like JasperReports (OpenSource - GNU AFFERO GENERAL PUBLIC LICENSE). For setting up data connection and templates, this open-source program has an intuitive desktop interface called “JasperStudio”.
Generate data sheets automatically online
As an alternative to the desktop application, you can also have your data sheets created online – sort of “on demand”. For this purpose, PDF generator software must be installed on a server system, and templates and data must be available on the system. The templates are then linked online with the product data and offered for download. Also in this case, you normally use your PIM system, a database or a JSON or XML file with structured product data as the data source.
You don’t have to stick with office formats for your templates, you can also create templates in HTML. With a suitable PDF engine, the HTML data generated on the server can then be automatically downloaded converted to PDF. Widely used professional PDF engines include PDFReactor or PrincePDF, in the OpenSource domain there is DomPDF or Pandoc.
The third way: JasperReports Server
Speaking about creating documents online, we should not forget to mention the third way, which is via report generators. For example, the data sources and XML-based document templates created in JasperStudio can also be used for server-based document creation. All that is required is to connect data and templates via the JasperReports server (OpenSource - GNU AFFERO GENERAL PUBLIC LICENSE). As output via download, everything from PDF to Word and Excel to HTML is possible.
How does the JasperReports server work?
The template for a Jasper Report can be easily created using the fairly intuitive Report Designer interface in JasperStudio. The connection to the data source is also configured in this tool. The configuration created in this way, consisting of template and data connection, can now be loaded into the JasperServer repository. Based on this, current documents can be retrieved from the server. It is is really fascinating to see how well this system works. This way, appealing and at the same time complex documents with hundreds of pages can be created in a few seconds.
Particularly noteworthy is the fact that the output is called up via REST API, which means that parameters can also be passed to the document to be generated dynamically. For example, the report server can run in the background of a web page on which current documents are to be displayed that are rendered live.
Benefits of using a JasperReports server
The bottleneck in using “ordinary” program libraries to create documents is the customization of templates and layouts by your own staff. In many cases where documents are created dynamically on the server side, the required templates as well as the data sources must be created by developers or at least specially trained web administrators. With JasperStudio, on the other hand, templates can be set up intuitively via the template designer and the establishment of data connections is a guided process. The basic qualification requirements and training time are thus considerably reduced. Fast adaptations of the document templates can be implemented in a very short time. The tedious task of commissioning changes from the IT department or an advertising or web agency is eliminated.
How do I separate data and layout (and logic)?
For the dynamic derivation of formatted content, it is important that data, layout and logic are separated from each other and are only switched together when needed. Note: There are experts who would say that the presentation is also part of the content, and therefore the strict separation of form and data is not always mandatory. For the sake of simplicity, however, we will disregard this view in the following.
Which data source do I use for my product data?
In order to automatically output product data sheets, product information on websites or product packaging, we need perfectly and as differentiated as possible granularly maintained product data. Alterra::PIM, for example, is an excellent platform for this. The system is characterized by the fact that the standard version already offers the widest possible range of functions for maintaining product data – such as inheritance functions, automatic calculation or conversion of values and many more. In addition, the data fields required for a product description can be configured individually, including combined fields and dependencies between data fields.
Connection to the data service
Once the product data set has been properly maintained, the next step is to establish a connection to the data service as easily as possible in order to link the data to a layout. In the case of Alterra::PIM, this can be done in several ways. Here are the most important ones:
- Web service: REST-API (JSON)
- Web service: XML output with parameters (optional BMECat)
- Web service: SOAP
- CSV export
- ODBC/JDBC interface
Layout: How do I build the template?
To go with JasperReports Server, there is a desktop application called Jaspersoft Studio. It features a graphical user interface where you can maintain data sources as well as templates and data mappings. The application is written in Java and therefore available for Windows, Mac and Linux. The template designer offers widgets for different output types, such as for static and dynamic text fields or even image fields.
A data source can be attached to a template. The data fields contained in the data source can be transferred to the layouts as placeholders using drag and drop. Then the formatting of the output is selected. For example, you can set the font, alignment, font size, and much more for a text field.
While working on the template, you can always check the result locally on your desktop. There, you can also see all available output formats. Once your template looks as it should, you can move the local version of the data source description as well as the template including data mapping to a JasperReports server. The final step is then the merging of the data and templates on the server. This process is started via the REST API of the report server.
The format to be output is controlled vis the file extension. Examples for output formats include:
HTML: http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.html PDF: http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.pdf Word: http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.docx Excel: http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.xls
Logic: How can I influence the layout, e.g. create crosstabs?
In practice, you often need comparative views of products, of their technical characteristics or simply of prices of different variants. For this purpose, JasperReports offers a suitable output format: the contingency table or “crosstab” element. Here you can define the grouping field, the line labels as well as the data area via a wizzard.
The processes involved in configuring outputs via JasperReports step by step:
The product data is created, translated and completed in PIM.
After that, we set up a data source in JaspersoftStudio that uses Alterra PIM’s REST API (output: JSON data). Data ranges can also be filtered directly here.
The template is now created in JaspersoftStudio via the GUI. The template is then also used to map data fields from Alterra::PIM and the data fields that can be used for the layout.
Now the template can be layouted. Here we can use all the data fields from the mapping in step 3, just drag and drop them into the template. You also control the output logic by inserting specific data fields into the “Report Header”, “Page”, “Page Header”, “Detail” “Page Footer” and “Report Footer” areas. For example, you can automatically insert repeating category names into the page header.
Last thing to do: test the document output in the JasperStudio development interface. If everything fits, the data source as well as the mapping and template are uploaded to the JasperReports server – again conveniently via the GUI. After that, by calling the appropriate URL, we can output the document in various formats: Word, PDF, Excel, PowerPoint. The output format is controlled simply by the file extension in the URL, e.g. http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.html for the HTML output and analogously http://localhost:8888/jasperserver/rest_v2/reports/case1/report1.pdf for the PDF and so on.
What alternative software can be used to create product data sheets?
In addition to the method of data output described in detail here, there are of course various other alternatives that can also be useful depending on the intended use. It is well known, for example, that in many marketing areas you can hardly get around the expertise of graphic designers, most of whom work with InDesign. For this reason, many companies use automation tools that are based on this technology. But be careful: Adobe data formats, like InDesign, are mostly patent-protected and not “open”. Therefore, they cannot be implemented as a web service; you have to resort to server tools provided by Adobe here (…which are not quite cheap).
Very widely used and also very efficient are PDF libraries like PDFReactor or PrincePDF. These libraries allow to create templates in HTML and then generate PDFs from them and combine them with the data. Depending on the template and data quality the results can be excellent. This means that they can also be used to dynamically generate glossy catalogs.
An alternative in the MS-Office domain is dox42, which works similar to JasperStudio, but is integrated with MS-Office. For example, templates can be built in MS Word and documents can be output automatically.
Last but not least, LibreOffice should be mentioned here, which can generate documents on the server side in headless mode. The templates required for this can be created in LibreOffice Writer. It is especially worth mentioning that the other parts of the LibreOffice suite also offer data formats that can be used to create templates. Both Impress and Calc can be output dynamically. Here, however, it is to be criticized that there is no graphical support for templating at all. Only the document can be prepared as an XML file and the XML can then be used as the basis for data generation. So all in all, it’s more something for experts.
Conclusion: JasperReports – the right template engine for me?
The final question remains whether JasperReports is the right tool for my purposes. What are the tools suitable for, and where am I better off using alternative methods? In principle, tools such as JasperReports are suitable for departments in which there is little or no programming know-how. Once a data source for a report is set up and the data fields are accessible, it is quite easy to configure appealing documents via the GUI. Grouping and arranging data is made possible by dividing the document design into grouping areas, even without knowledge of SQL, XSL or JSON filters. The fact that you can easily upload your set up on the desktop report configuration to a JasperReports server makes it possible even for non-experts to make dynamic documents accessible via URL over the web. The system’s performance is also very good in both the desktop and server areas.
However, one thing must also be stated quite clearly: If data must be brought into a complex layout or data must be converted or combined before output, even the best GUI reaches its limits. However, complex requirements can then be implemented by simply switching from the drag and drop interface to source code mode. In this respect, the tool is very usable for both non-programmers and experts.
So, if you don’t have to submit to the constraint of using Adobe software to generate documents for operational reasons, automating the output of product data via JasperReports is an absolutely recommendable alternative.