Here we will go through a simple “Hello World” example. We want to create an output with the simple text ‘Hello World’ on a page and then also include a text from an XML file.
Before you start the designer you might want to copy some fonts to the /resources/fonts directory (some are included in a new installation). If you have an XML file you can also copy that to the /resources/document directory in the InterFormNG data directory - or you can use one of the demo XML files, which are included in /resources/document/Intro.
Now start the designer. The designer starts up with a new template (=form or overlay). You can now import your XML file by selecting this icon:
Then select your XML file:
Then click the ‘Statics’ folder inside the Page element and insert a Text element:
- then click in the result window to tell the designer where to place this text in the output.
You can now type the text to be inserted:
If you also want to output data from your XML file, you should first display the XML file in the designer. You can e.g. do that by selecting this in the top:
This divides the right of the screen in two: The upper part is the input XML file and the lower part is the result.
If you now select the previous text element in the element list, and now insert a new text element (and click in the result window where it should be printed), you can now refer to the contents of the XML file:
Change the selection input into ‘Xpath’. Now you can select contents from the XML file simply by first marking the field in the XML file, and click the ‘Select from document’ icon, and then the path is copied into the Xpath expression. You can also enter this manually, or alter this to include various Xpath functions.
Now you can verify the final result in PDF by clicking this icon on the upper right:
Now you can continue to build in additional functions your first template. If you e.g. insert a Flow area and inside of this insert a ForEach, then you can loop through all nodes with a simular path and print each node with the Text element - remember to insert a NewLine element to force a line break: