The xTuple report writer supports two advanced features that enable you to make your reports visually appealing and add a level of security that makes it easier to determine if a printed report is the original or a duplicate. These two features are watermarks and background images.
A watermark is text that is printed across the background of a report and is usually defined with an opacity factor that cause the printing to be lighter than the report’s foreground content.
A background image is similar to a watermark in that it is displayed in the background of the report’s output and its opacity can be controlled. However, as its name implies, a background image is graphical, not textual, in nature.
The use of watermarks and background images is not mutually exclusive; a report may employ both. Also, both may be static or dynamic in nature. That is to say, a watermark may have a fixed value, or its value may be derived from a query source that retrieves it from the database. A static background image references a single image for the report. A dynamic background image can use a query against the images
table to retrieve a different image (perhaps a customer’s logo) based on parameter values passed to the report at run-time.
Below is a report that employees both an static background image and a static watermark:
Both watermarks and background images are defined in the Report Properties session. To open this session first open the report writer and then the report to which you want to add or change the watermark or background image. Next:
Pull down the Document menu
Click on the “Properties” option
The Info tab enables you to provide a descriptive title for your report and a detailed description that may, in the future, help others understand how your report works or should be used.
Background images are defined on the Report Properties session under the Background tab:
To enable Background images, the Enable Background image box must be checked.
There are two types of Background image: static and dynamic. Our example depicts a static background image: one where the image shown never changes.
A dynamic background image can be displayed from the xTuple images
table based on the results of a the SQL in a query source. The column field would then reference the image_data
column which contains the image data. Company logos, product images, and employee photos, just to name a few, can be stored in the images
table and pulled dynamically into a report through the SQL in a query source.
Within the Background tab there are three sub-tabs: General, Layout, and Static Image.
The General tab controls the Source of the image: static or dynamic. The query source and column, if it is a dynamic background image, references the SQL query source and the column retrieved by it that contains the image data. The Opacity slider controls the level of transparency that the background image will posses when displayed.
The Layout tab for background images controls whether the image is shown at its original size (the Clip option) or it is stretched (the Stretch option) based on the values of the fields Width and Height.
Other settings on this tab control the position of the background image in the report
The Static Image tab for background images only applies to static background images.
When you click on the LOAD button, you are presented with your operating system’s locate file dialogue. Selecting the image locally and clicking OK returns you to the Static Image tab and a view of the image.
Static background images are embedded in XML that is stored in the column report_source
in the table report. As such, when you save a report definition locally in XML format, the static image is embedded in it and transported with it.
Watermarks are defined on the Report Properties session under the Watermarks tab. Let’s take a look at the screen that enable us to control watermarks:
Like background images, watermarks can also be static or dynamic.
The value of a dynamic watermark may be provided through the results of an SQL query referenced in the fields query source and columns. Likewise, the value of a parameter value passed to the report at run-time can also be displayed by selecting Parameter Query in the query source field and entering the name of the parameter in the column field.
The characteristics of the watermark, its size, font, and opacity, are controlled by the other fields on the Watermark tab.