10. The barcodes and dynamic images example explained
The personCard.xre example in the database which shows how to:
This example creates a personal card with the name and address of a person together with the photo and a barcode which encodes the name of the person. The input file is a XML file with a list of persons and their information, the schema of the XML file is very simple:
The card has been split in 4 columns, the first one contains the photo
and the last one contains the barcodes. These are the 2 objects we are
interested in.
The image object could be a static image file if you enter a file name in the image field, however in this example we want to select a different image for each person (the photo), so we use the xpath field and enter the value concat('examples/barcodes/foto_',id,'.PNG').
This expression concatenates the 3 values:
Since one of the persons has the id 12345 the result for that person will be examples/barcodes/foto_12345.jpg. So that is the file that will be used as photo for that person.
Note that we used the id instead of /list/person/id in the concat function. Since the XMLNode of the detail area (the card) is /list/person, we have to use the value id to find the correct value for the current person.
The barcode is the second interesting object in this example. When you add a barcode to your document the barcode type selection window will popup. At this point you have to decide if it will be a 1D barcode (e.g. EAN or Code128) or a 2D barcode (Datamatrix, PDF417 ...).
Once the barcode is in your document you can distinguish 2 kind of properties:
can find more information about the barcode specific properties here http://www.java4less.com/barcodes/barcodes.php?info=guide